Struct IPAddress
Manipulation of IP addresses.
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 7.19.2Syntax
[Obsolete("This class is no longer used, and its use is discouraged because it is not compatible with IPv6 addresses", false)]
public struct IPAddress
Remarks
There is an ip address class defined in the .NET Framework (System.Net.IPAddress) but it does not give direct access to the individual IP address octets. Therefore we have this special-purpose struct.
Constructors
IPAddress(Int32, Int32, Int32, Int32)
Will create the ip address structure from the four components.
Declaration
public IPAddress(int ip1, int ip2, int ip3, int ip4)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ip1 | Address part 1 |
System.Int32 | ip2 | Address part 2 |
System.Int32 | ip3 | Address part 3 |
System.Int32 | ip4 | Address part 4 |
Remarks
Represets the ip address "ip1.ip2.ip3.ip4"
IPAddress(String)
Will create the ip address structure from the string parameter.
Declaration
public IPAddress(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | A "dotted" ip address. |
Remarks
Expects IP addresses in the form "x.x.x.x". If an illegal address is detected the IP address will be set to NoAddress.
Fields
NoAddress
The "null" IPv4 address 0.0.0.0
Declaration
public static IPAddress NoAddress
Field Value
Type | Description |
---|---|
IPAddress |
Properties
IP1
Gets the first component of the IP address.
Declaration
public int IP1 { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IP2
Gets the second component of the IP address.
Declaration
public int IP2 { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IP3
Gets the third component of the IP address.
Declaration
public int IP3 { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IP4
Gets the last component of the IP address.
Declaration
public int IP4 { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
Operators
Equality(IPAddress, IPAddress)
Implements the operator ==.
Declaration
public static bool operator ==(IPAddress x, IPAddress y)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | x | The x. |
IPAddress | y | The y. |
Returns
Type | Description |
---|---|
System.Boolean | The result of the operator. |
Inequality(IPAddress, IPAddress)
Implements the operator !=.
Declaration
public static bool operator !=(IPAddress x, IPAddress y)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | x | The x. |
IPAddress | y | The y. |
Returns
Type | Description |
---|---|
System.Boolean | The result of the operator. |