PhysicalAddress::Parse Method (String^)
Parses the specified String and stores its contents as the address bytes of the PhysicalAddress returned by this method.
Assembly: System (in System.dll)
Parameters
- address
-
Type:
System::String^
A String containing the address that will be used to initialize the PhysicalAddress instance returned by this method.
Return Value
Type: System.Net.NetworkInformation::PhysicalAddress^A PhysicalAddress instance with the specified address.
| Exception | Condition |
|---|---|
| FormatException | The address parameter contains an illegal hardware address. This exception also occurs if the address parameter contains a string in the incorrect format. |
The address parameter must contain a string that can only consist of numbers and upper-case letters as hexadecimal digits. Some examples of string formats that are acceptable are as follows:
001122334455
00-11-22-33-44-55
F0-E1-D2-C3-B4-A5
Note that an address that contains f0-e1-d2-c3-b4-a5 will fail to parse and throw an exception.
Use the GetAddressBytes method to retrieve the address from an existing PhysicalAddress instance.
The following code example creates a PhysicalAddress instance by calling the Parse method.
Available since 2.0