# Struct Status (2.66.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.66.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status)
- [2.63.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.Status)
- [2.48.0](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.Status)

    public struct Status

Represents RPC result, which consists of [StatusCode](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status#Grpc_Core_Status_StatusCode) and an optional detail string.

## Inherited Members

[ValueType.Equals(object)](https://learn.microsoft.com/dotnet/api/system.valuetype.equals) [ValueType.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.valuetype.gethashcode) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

## Namespace

[Grpc.Core](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)

## Assembly

Grpc.Core.Api.dll

## Constructors

### Status(StatusCode, string)

    public Status(StatusCode statusCode, string detail)

Creates a new instance of `Status`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `statusCode` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.StatusCode` Status code. |
| `detail` | `https://learn.microsoft.com/dotnet/api/system.string` Detail. |

### Status(StatusCode, string, Exception?)

    public Status(StatusCode statusCode, string detail, Exception? debugException)

Creates a new instance of `Status`.
Users should not use this constructor, except for creating instances for testing.
The debug error string should only be populated by gRPC internals.
Note: experimental API that can change or be removed without any prior notice.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `statusCode` | `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.StatusCode` Status code. |
| `detail` | `https://learn.microsoft.com/dotnet/api/system.string` Detail. |
| `debugException` | `https://learn.microsoft.com/dotnet/api/system.exception` Optional internal error details. |

## Fields

### DefaultCancelled

    public static readonly Status DefaultCancelled

Default result of a cancelled RPC. StatusCode=Cancelled, empty details message.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status` |   |

### DefaultSuccess

    public static readonly Status DefaultSuccess

Default result of a successful RPC. StatusCode=OK, empty details message.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status` |   |

## Properties

### DebugException

    public readonly Exception? DebugException { get; }

In case of an error, this field may contain additional error details to help with debugging.
This field will be only populated on a client and its value is generated locally,
based on the internal state of the gRPC client stack (i.e. the value is never sent over the wire).
Note that this field is available only for debugging purposes, the application logic should
never rely on values of this field (it should use `StatusCode` and `Detail` instead).
Example: when a client fails to connect to a server, this field may provide additional details
why the connection to the server has failed.
Note: experimental API that can change or be removed without any prior notice.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.exception` |   |

### Detail

    public readonly string Detail { get; }

Gets the detail.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### StatusCode

    public readonly StatusCode StatusCode { get; }

Gets the gRPC status code. OK indicates success, all other values indicate an error.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.StatusCode` |   |

## Methods

### ToString()

    public override string ToString()

Returns a [string](https://learn.microsoft.com/dotnet/api/system.string) that represents the current [Status](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Status).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Overrides** [ValueType.ToString()](https://learn.microsoft.com/dotnet/api/system.valuetype.tostring)