Class MethodDescriptor (3.23.0)

public sealed class MethodDescriptor : DescriptorBase, IDescriptor

Describes a single method in a service.

Inheritance

object > DescriptorBase > MethodDescriptor

Implements

IDescriptor

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Properties

CustomOptions

[Obsolete("CustomOptions are obsolete. Use the GetOptions() method.")]
public CustomOptions CustomOptions { get; }

The (possibly empty) set of custom options for this method.

Property Value
TypeDescription
CustomOptions

InputType

public MessageDescriptor InputType { get; }
Property Value
TypeDescription
MessageDescriptor

The method's input type.

IsClientStreaming

public bool IsClientStreaming { get; }
Property Value
TypeDescription
bool

Indicates if client streams multiple requests.

IsServerStreaming

public bool IsServerStreaming { get; }
Property Value
TypeDescription
bool

Indicates if server streams multiple responses.

Name

public override string Name { get; }

The brief name of the descriptor's target.

Property Value
TypeDescription
string
Overrides

OutputType

public MessageDescriptor OutputType { get; }
Property Value
TypeDescription
MessageDescriptor

The method's input type.

Service

public ServiceDescriptor Service { get; }
Property Value
TypeDescription
ServiceDescriptor

The service this method belongs to.

Methods

GetOption<T>(Extension<MethodOptions, T>)

[Obsolete("GetOption is obsolete. Use the GetOptions() method.")]
public T GetOption<T>(Extension<MethodOptions, T> extension)

Gets a single value method option for this descriptor

Parameter
NameDescription
extensionExtensionMethodOptions
Returns
TypeDescription
T
Type Parameter
NameDescription
T

GetOption<T>(RepeatedExtension<MethodOptions, T>)

[Obsolete("GetOption is obsolete. Use the GetOptions() method.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<MethodOptions, T> extension)

Gets a repeated value method option for this descriptor

Parameter
NameDescription
extensionRepeatedExtensionMethodOptions
Returns
TypeDescription
RepeatedField
Type Parameter
NameDescription
T

GetOptions()

public MethodOptions GetOptions()

The MethodOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved.

Returns
TypeDescription
MethodOptions

ToProto()

public MethodDescriptorProto ToProto()

Returns a clone of the underlying MethodDescriptorProto describing this method. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value.

Returns
TypeDescription
MethodDescriptorProto

A protobuf representation of this method descriptor.