mscorlib(4.0.0.0) API with additions
DnsEndPoint.cs
1 using System.Net.Sockets;
2 
3 namespace System.Net
4 {
6  [global::__DynamicallyInvokable]
7  public class DnsEndPoint : EndPoint
8  {
9  private string m_Host;
10 
11  private int m_Port;
12 
13  private AddressFamily m_Family;
14 
17  [global::__DynamicallyInvokable]
18  public string Host
19  {
20  [global::__DynamicallyInvokable]
21  get
22  {
23  return m_Host;
24  }
25  }
26 
29  [global::__DynamicallyInvokable]
30  public override AddressFamily AddressFamily
31  {
32  [global::__DynamicallyInvokable]
33  get
34  {
35  return m_Family;
36  }
37  }
38 
41  [global::__DynamicallyInvokable]
42  public int Port
43  {
44  [global::__DynamicallyInvokable]
45  get
46  {
47  return m_Port;
48  }
49  }
50 
59  [global::__DynamicallyInvokable]
60  public DnsEndPoint(string host, int port)
61  : this(host, port, AddressFamily.Unspecified)
62  {
63  }
64 
75  [global::__DynamicallyInvokable]
76  public DnsEndPoint(string host, int port, AddressFamily addressFamily)
77  {
78  if (host == null)
79  {
80  throw new ArgumentNullException("host");
81  }
82  if (string.IsNullOrEmpty(host))
83  {
84  throw new ArgumentException(SR.GetString("net_emptystringcall", "host"));
85  }
86  if (port < 0 || port > 65535)
87  {
88  throw new ArgumentOutOfRangeException("port");
89  }
90  if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6 && addressFamily != 0)
91  {
92  throw new ArgumentException(SR.GetString("net_sockets_invalid_optionValue_all"), "addressFamily");
93  }
94  m_Host = host;
95  m_Port = port;
96  m_Family = addressFamily;
97  }
98 
103  [global::__DynamicallyInvokable]
104  public override bool Equals(object comparand)
105  {
106  DnsEndPoint dnsEndPoint = comparand as DnsEndPoint;
107  if (dnsEndPoint == null)
108  {
109  return false;
110  }
111  if (m_Family == dnsEndPoint.m_Family && m_Port == dnsEndPoint.m_Port)
112  {
113  return m_Host == dnsEndPoint.m_Host;
114  }
115  return false;
116  }
117 
120  [global::__DynamicallyInvokable]
121  public override int GetHashCode()
122  {
124  }
125 
128  [global::__DynamicallyInvokable]
129  public override string ToString()
130  {
131  return m_Family + "/" + m_Host + ":" + m_Port;
132  }
133  }
134 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
DnsEndPoint(string host, int port, AddressFamily addressFamily)
Initializes a new instance of the T:System.Net.DnsEndPoint class with the host name or string represe...
Definition: DnsEndPoint.cs:76
int Port
Gets the port number of the T:System.Net.DnsEndPoint.
Definition: DnsEndPoint.cs:43
int GetHashCode(object obj)
When overridden in a derived class, gets the hash code for the specified object.
override int GetHashCode()
Returns a hash value for a T:System.Net.DnsEndPoint.
Definition: DnsEndPoint.cs:121
override bool Equals(object comparand)
Compares two T:System.Net.DnsEndPoint objects.
Definition: DnsEndPoint.cs:104
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
override string ToString()
Returns the host name or string representation of the IP address and port number of the T:System....
Definition: DnsEndPoint.cs:129
Represents a network endpoint as a host name or a string representation of an IP address and a port n...
Definition: DnsEndPoint.cs:7
AddressFamily
Specifies the addressing scheme that an instance of the T:System.Net.Sockets.Socket class can use.
Definition: AddressFamily.cs:5
static StringComparer InvariantCultureIgnoreCase
Gets a T:System.StringComparer object that performs a case-insensitive string comparison using the wo...
The exception that is thrown when one of the arguments provided to a method is not valid.
DnsEndPoint(string host, int port)
Initializes a new instance of the T:System.Net.DnsEndPoint class with the host name or string represe...
Definition: DnsEndPoint.cs:60
Identifies a network address. This is an abstract class.
Definition: EndPoint.cs:8
string Host
Gets the host name or string representation of the Internet Protocol (IP) address of the host.
Definition: DnsEndPoint.cs:19
Represents a string comparison operation that uses specific case and culture-based or ordinal compari...
The time represented is not specified as either local time or Coordinated Universal Time (UTC).