Class MongoServerAddress
The address of a MongoDB server.
[Serializable]
public class MongoServerAddress : IEquatable<MongoServerAddress>
- Inheritance
-
MongoServerAddress
- Implements
- Inherited Members
Constructors
MongoServerAddress(string)
Initializes a new instance of MongoServerAddress.
public MongoServerAddress(string host)
Parameters
host
stringThe server's host name.
MongoServerAddress(string, int)
Initializes a new instance of MongoServerAddress.
public MongoServerAddress(string host, int port)
Parameters
Properties
Host
Gets the server's host name.
public string Host { get; }
Property Value
Port
Gets the server's port number.
public int Port { get; }
Property Value
Methods
Equals(MongoServerAddress)
Compares two server addresses.
public bool Equals(MongoServerAddress rhs)
Parameters
rhs
MongoServerAddressThe other server address.
Returns
- bool
True if the two server addresses are equal.
Equals(object)
Compares two server addresses.
public override bool Equals(object obj)
Parameters
obj
objectThe other server address.
Returns
- bool
True if the two server addresses are equal.
GetHashCode()
Gets the hash code for this object.
public override int GetHashCode()
Returns
- int
The hash code.
Parse(string)
Parses a string representation of a server address.
public static MongoServerAddress Parse(string value)
Parameters
value
stringThe string representation of a server address.
Returns
- MongoServerAddress
A new instance of MongoServerAddress initialized with values parsed from the string.
ToString()
Returns a string representation of the server address.
public override string ToString()
Returns
- string
A string representation of the server address.
TryParse(string, out MongoServerAddress)
Tries to parse a string representation of a server address.
public static bool TryParse(string value, out MongoServerAddress address)
Parameters
value
stringThe string representation of a server address.
address
MongoServerAddressThe server address (set to null if TryParse fails).
Returns
- bool
True if the string is parsed succesfully.
Operators
operator ==(MongoServerAddress, MongoServerAddress)
Compares two server addresses.
public static bool operator ==(MongoServerAddress lhs, MongoServerAddress rhs)
Parameters
lhs
MongoServerAddressThe first address.
rhs
MongoServerAddressThe other address.
Returns
- bool
True if the two addresses are equal (or both are null).
operator !=(MongoServerAddress, MongoServerAddress)
Compares two server addresses.
public static bool operator !=(MongoServerAddress lhs, MongoServerAddress rhs)
Parameters
lhs
MongoServerAddressThe first address.
rhs
MongoServerAddressThe other address.
Returns
- bool
True if the two addresses are not equal (or one is null and the other is not).