# Class OneofAccessor (3.27.1)

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

- [3.27.1 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.OneofAccessor)
- [3.23.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.Reflection.OneofAccessor)
- [3.15.8](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.Reflection.OneofAccessor)

    public sealed class OneofAccessor

Reflection access for a oneof, allowing clear and "get case" actions.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> OneofAccessor

## Inherited Members

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

## Namespace

[Google.Protobuf.Reflection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection)

## Assembly

Google.Protobuf.dll

## Properties

### Descriptor

    public OneofDescriptor Descriptor { get; }

Gets the descriptor for this oneof.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.OneofDescriptor` | The descriptor of the oneof. |

## Methods

### Clear(IMessage)

    public void Clear(IMessage message)

Clears the oneof in the specified message.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage` |

### GetCaseFieldDescriptor(IMessage)

    public FieldDescriptor GetCaseFieldDescriptor(IMessage message)

Indicates which field in the oneof is set for specified message

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.FieldDescriptor` |   |