Redigera

Dela via


PhysicalAddress.TryParse Method

Definition

Overloads

TryParse(ReadOnlySpan<Char>, PhysicalAddress)

Tries to convert the span representation of a hardware address to a PhysicalAddress instance. A return value indicates whether the conversion succeeded.

TryParse(String, PhysicalAddress)

Tries to convert the string representation of a hardware address to a PhysicalAddress instance. A return value indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, PhysicalAddress)

Source:
PhysicalAddress.cs
Source:
PhysicalAddress.cs
Source:
PhysicalAddress.cs

Tries to convert the span representation of a hardware address to a PhysicalAddress instance. A return value indicates whether the conversion succeeded.

public:
 static bool TryParse(ReadOnlySpan<char> address, [Runtime::InteropServices::Out] System::Net::NetworkInformation::PhysicalAddress ^ % value);
public static bool TryParse (ReadOnlySpan<char> address, out System.Net.NetworkInformation.PhysicalAddress? value);
static member TryParse : ReadOnlySpan<char> * PhysicalAddress -> bool
Public Shared Function TryParse (address As ReadOnlySpan(Of Char), ByRef value As PhysicalAddress) As Boolean

Parameters

address
ReadOnlySpan<Char>

A span containing the address that will be used to initialize the PhysicalAddress instance returned by this method.

value
PhysicalAddress

When this method returns, contains the PhysicalAddress instance equivalent of the address contained in address, if the conversion succeeded, or null if the conversion failed. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Returns

true if address was converted successfully; otherwise, false.

Remarks

The address parameter must contain a string that can only consist of numbers and letters as hexadecimal digits. Some examples of string formats that are acceptable are as follows:

001122334455

00-11-22-33-44-55

0011.2233.4455

00:11:22:33:44:55

F0-E1-D2-C3-B4-A5

f0-e1-d2-c3-b4-a5

Use the GetAddressBytes method to retrieve the address from an existing PhysicalAddress instance.

Applies to

TryParse(String, PhysicalAddress)

Source:
PhysicalAddress.cs
Source:
PhysicalAddress.cs
Source:
PhysicalAddress.cs

Tries to convert the string representation of a hardware address to a PhysicalAddress instance. A return value indicates whether the conversion succeeded.

public:
 static bool TryParse(System::String ^ address, [Runtime::InteropServices::Out] System::Net::NetworkInformation::PhysicalAddress ^ % value);
public static bool TryParse (string? address, out System.Net.NetworkInformation.PhysicalAddress? value);
static member TryParse : string * PhysicalAddress -> bool
Public Shared Function TryParse (address As String, ByRef value As PhysicalAddress) As Boolean

Parameters

address
String

A string containing the address that will be used to initialize the PhysicalAddress instance returned by this method.

value
PhysicalAddress

When this method returns, contains the PhysicalAddress instance equivalent of the address contained in address, if the conversion succeeded, or null if the conversion failed. If the address is null it contains None. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Returns

true if address was converted successfully; otherwise, false.

Remarks

The address parameter must contain a string that can only consist of numbers and letters as hexadecimal digits. Some examples of string formats that are acceptable are as follows:

001122334455

00-11-22-33-44-55

0011.2233.4455

00:11:22:33:44:55

F0-E1-D2-C3-B4-A5

f0-e1-d2-c3-b4-a5

Use the GetAddressBytes method to retrieve the address from an existing PhysicalAddress instance.

Applies to