Class MethodDescriptor (3.27.1)

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
Type Description
CustomOptions

InputType

public MessageDescriptor InputType { get; }
Property Value
Type Description
MessageDescriptor

The method's input type.

IsClientStreaming

public bool IsClientStreaming { get; }
Property Value
Type Description
bool

Indicates if client streams multiple requests.

IsServerStreaming

public bool IsServerStreaming { get; }
Property Value
Type Description
bool

Indicates if server streams multiple responses.

Name

public override string Name { get; }

The brief name of the descriptor's target.

Property Value
Type Description
string
Overrides

OutputType

public MessageDescriptor OutputType { get; }
Property Value
Type Description
MessageDescriptor

The method's input type.

Service

public ServiceDescriptor Service { get; }
Property Value
Type Description
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
Name Description
extension ExtensionMethodOptions
Returns
Type Description
T
Type Parameter
Name Description
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
Name Description
extension RepeatedExtensionMethodOptions
Returns
Type Description
RepeatedField
Type Parameter
Name Description
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
Type Description
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
Type Description
MethodDescriptorProto

A protobuf representation of this method descriptor.