Class ServiceEndpoint
Settings specifying a service endpoint in the form of a host name and port. This class is immutable and thread-safe.
Inheritance
Implements
Inherited Members
Namespace: Google.Api.Gax.Grpc
Assembly: Google.Api.Gax.Grpc.dll
Syntax
public sealed class ServiceEndpoint : IEquatable<ServiceEndpoint>
Constructors
ServiceEndpoint(String)
Creates a new endpoint with the given host, using a port of 443.
Declaration
public ServiceEndpoint(string host)
Parameters
Type | Name | Description |
---|---|---|
System.String | host | The host name to connect to. Must not be null or empty. |
ServiceEndpoint(String, Int32)
Creates a new endpoint with the given host and port.
Declaration
public ServiceEndpoint(string host, int port)
Parameters
Type | Name | Description |
---|---|---|
System.String | host | The host name to connect to. Must not be null or empty. |
System.Int32 | port | The port to connect to, in the range 1 to 65535 inclusive. |
Properties
Host
The host name to connect to. Never null or empty.
Declaration
public string Host { get; }
Property Value
Type | Description |
---|---|
System.String |
Port
The port to connect to, in the range 1 to 65535 inclusive.
Declaration
public int Port { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Equals(ServiceEndpoint)
Determines equality between this endpoint and other
.
Declaration
public bool Equals(ServiceEndpoint other)
Parameters
Type | Name | Description |
---|---|---|
ServiceEndpoint | other | The object to compare with this one. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Implements
Equals(Object)
Determines equality between this object and obj
.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with this one. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this object, consistent with Equals(ServiceEndpoint).
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this object. |
Overrides
Parse(String)
Parses the specified value as an endpoint.
Declaration
public static ServiceEndpoint Parse(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to parse. |
Returns
Type | Description |
---|---|
ServiceEndpoint | The resulting endpoint. |
Remarks
Valid formats are:
The port defaults to 443 if it is not otherwise specified. If it is specified, it must be in the range 1-65535 inclusive.
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
ToString()
Returns this endpoint's data in the format "host:port".
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | This endpoint's data in the format "host:port". |
Overrides
TryParse(String, out ServiceEndpoint)
Tries to parse the specified value as an endpoint.
Declaration
public static bool TryParse(string text, out ServiceEndpoint endpoint)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to parse. |
ServiceEndpoint | endpoint | The resulting endpoint, or |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
Valid formats are:
The port defaults to 443 if it is not otherwise specified. If it is specified, it must be in the range 1-65535 inclusive.
WithHost(String)
Creates a new endpoint with the same port but the given host.
Declaration
public ServiceEndpoint WithHost(string host)
Parameters
Type | Name | Description |
---|---|---|
System.String | host | The host name to connect to. Must not be null or empty. |
Returns
Type | Description |
---|---|
ServiceEndpoint | A new endpoint with the current port and the specified host. |
WithPort(Int32)
Creates a new endpoint with the same host but the given port.
Declaration
public ServiceEndpoint WithPort(int port)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | port | The port to connect to, in the range 1 to 65535 inclusive. |
Returns
Type | Description |
---|---|
ServiceEndpoint | A new endpoint with the current host and the specified port. |