Interface IFieldAccessor (3.15.8)

public interface IFieldAccessor

Allows fields to be reflectively accessed.

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Properties

Descriptor

FieldDescriptor Descriptor { get; }

Returns the descriptor associated with this field.

Property Value
TypeDescription
FieldDescriptor

Methods

Clear(IMessage)

void Clear(IMessage message)

Clears the field in the specified message. (For repeated fields, this clears the list.)

Parameter
NameDescription
messageIMessage

GetValue(IMessage)

object GetValue(IMessage message)

Fetches the field value. For repeated values, this will be an implementation. For map values, this will be an implementation.

Parameter
NameDescription
messageIMessage
Returns
TypeDescription
Object

HasValue(IMessage)

bool HasValue(IMessage message)

Indicates whether the field in the specified message is set. For proto3 fields that aren't explicitly optional, this throws an

Parameter
NameDescription
messageIMessage
Returns
TypeDescription
Boolean

SetValue(IMessage, Object)

void SetValue(IMessage message, object value)

Mutator for single "simple" fields only.

Parameters
NameDescription
messageIMessage
valueObject
Remarks

Repeated fields are mutated by fetching the value and manipulating it as a list. Map fields are mutated by fetching the value and manipulating it as a dictionary.