Class FieldDescriptor
Descriptor for a field or extension within a message in a .proto file.
Inheritance
System.Object
FieldDescriptor
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Google.Protobuf.dll
Syntax
public sealed class FieldDescriptor : DescriptorBase, IDescriptor, IComparable<FieldDescriptor>
Properties
Accessor
Returns the accessor for this field.
Declaration
public IFieldAccessor Accessor { get; }
Property Value
ContainingOneof
Returns the oneof containing this field, or null
if it is not part of a oneof.
Declaration
public OneofDescriptor ContainingOneof { get; }
Property Value
ContainingType
Get the field's containing message type, or null
if it is a field defined at the top level of a file as an extension.
Declaration
public MessageDescriptor ContainingType { get; }
Property Value
CustomOptions
The (possibly empty) set of custom options for this field.
Declaration
[Obsolete("CustomOptions are obsolete. Use GetOption")]
public CustomOptions CustomOptions { get; }
Property Value
EnumType
For enum fields, returns the field's type.
Declaration
public EnumDescriptor EnumType { get; }
Property Value
ExtendeeType
For extension fields, returns the extended type
Declaration
public MessageDescriptor ExtendeeType { get; }
Property Value
Extension
An extension identifier for this field, or null
if this field isn't an extension.
Declaration
public Extension Extension { get; }
Property Value
FieldNumber
Returns the field number declared in the proto file.
Declaration
public int FieldNumber { get; }
Property Value
Type |
Description |
System.Int32 |
|
FieldType
Returns the type of the field.
Declaration
public FieldType FieldType { get; }
Property Value
IsExtension
Returns true
if this field extends another message type; false
otherwise.
Declaration
public bool IsExtension { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsMap
Returns true
if this field is a map field; false
otherwise.
Declaration
public bool IsMap { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsPacked
Returns true
if this field is a packed, repeated field; false
otherwise.
Declaration
public bool IsPacked { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsRepeated
Returns true
if this field is a repeated field; false
otherwise.
Declaration
public bool IsRepeated { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsRequired
Returns true
if this field is a required field; false
otherwise.
Declaration
public bool IsRequired { get; }
Property Value
Type |
Description |
System.Boolean |
|
JsonName
The effective JSON name for this field. This is usually the lower-camel-cased form of the field name,
but can be overridden using the json_name
option in the .proto file.
Declaration
public string JsonName { get; }
Property Value
Type |
Description |
System.String |
|
MessageType
For embedded message and group fields, returns the field's type.
Declaration
public MessageDescriptor MessageType { get; }
Property Value
Name
The brief name of the descriptor's target.
Declaration
public override string Name { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
Methods
CompareTo(FieldDescriptor)
Compares this descriptor with another one, ordering in "canonical" order
which simply means ascending order by field number. other
must be a field of the same type, i.e. the ContainingType of
both fields must be the same.
Declaration
public int CompareTo(FieldDescriptor other)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Implements
System.IComparable<T>.CompareTo(T)
GetOption<T>(Extension<FieldOptions, T>)
Gets a single value field option for this descriptor
Declaration
public T GetOption<T>(Extension<FieldOptions, T> extension)
Parameters
Returns
Type Parameters
GetOption<T>(RepeatedExtension<FieldOptions, T>)
Gets a repeated value field option for this descriptor
Declaration
public RepeatedField<T> GetOption<T>(RepeatedExtension<FieldOptions, T> extension)
Parameters
Returns
Type Parameters