Class ServiceDescriptor (3.23.0)

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
TypeDescription
CustomOptions

Methods

public IList<MethodDescriptor> Methods { get; }
Property Value
TypeDescription
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
TypeDescription
string
Overrides

Methods

FindMethodByName(string)

public MethodDescriptor FindMethodByName(string name)

Finds a method by name.

Parameter
NameDescription
namestring

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

Returns
TypeDescription
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
NameDescription
extensionExtensionServiceOptions
Returns
TypeDescription
T
Type Parameter
NameDescription
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
NameDescription
extensionRepeatedExtensionServiceOptions
Returns
TypeDescription
RepeatedField
Type Parameter
NameDescription
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
TypeDescription
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
TypeDescription
ServiceDescriptorProto

A protobuf representation of this service descriptor.