Class ServiceDescriptor (3.27.1)

public sealed class ServiceDescriptor : DescriptorBase, IDescriptor

Describes a service type.

Inheritance

object > DescriptorBase > ServiceDescriptor

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 service.

Property Value
Type Description
CustomOptions

Methods

public IList<MethodDescriptor> Methods { get; }
Property Value
Type Description
IListMethodDescriptor

An unmodifiable list of methods in this service.

Name

public override string Name { get; }

The brief name of the descriptor's target.

Property Value
Type Description
string
Overrides

Methods

FindMethodByName(string)

public MethodDescriptor FindMethodByName(string name)

Finds a method by name.

Parameter
Name Description
name string

The unqualified name of the method (e.g. "Foo").

Returns
Type Description
MethodDescriptor

The method's descriptor, or null if not found.

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

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

Gets a single value service option for this descriptor

Parameter
Name Description
extension ExtensionServiceOptions
Returns
Type Description
T
Type Parameter
Name Description
T

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

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

Gets a repeated value service option for this descriptor

Parameter
Name Description
extension RepeatedExtensionServiceOptions
Returns
Type Description
RepeatedField
Type Parameter
Name Description
T

GetOptions()

public ServiceOptions GetOptions()

The ServiceOptions, 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
ServiceOptions

ToProto()

public ServiceDescriptorProto ToProto()

Returns a clone of the underlying ServiceDescriptorProto describing this service. 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
ServiceDescriptorProto

A protobuf representation of this service descriptor.