MacAddress
IEEE 802 MAC address in canonical form: six uppercase hex pairs joined by colons (AA:BB:CC:DD:EE:FF). The generated From accepts ONLY that canonical form - use FromAnyFormat(string) for wire input (dashes, dots, no separator, lowercase).
[ValueObject(typeof(string))]
public struct MacAddress : ValueType
1. Attributes
1.1. ValueObject
ValueObject
2. Properties
2.1. Oui
Vendor (OUI) part of this address - the first three octets.
public OuiPrefix Oui { get; }
3. Methods
3.1. FromAnyFormat(string)
Normalize any common MAC rendering to canonical form and create the value object. Accepts AA:BB:CC:DD:EE:FF, aa-bb-cc-dd-ee-ff, aabb.ccdd.eeff and AABBCCDDEEFF.
public static MacAddress FromAnyFormat(string raw)
| Name | Type | Description |
|---|---|---|
raw |
string |
MAC address in any of the supported renderings. |
Returns: MacAddress
3.2. FromOctets(IReadOnlyList<byte>)
Render six address octets as a canonical MAC address.
public static MacAddress FromOctets(IReadOnlyList<byte> octets)
| Name | Type | Description |
|---|---|---|
octets |
IReadOnlyList<byte> |
Exactly six address bytes. |
Returns: MacAddress
3.3. TryFromAnyFormat(string, MacAddress?)
Non-throwing counterpart of FromAnyFormat(string). The out parameter is nullable because a Vogen value object must never be handed out as default.
public static bool TryFromAnyFormat(string raw, out MacAddress? result)
| Name | Type | Description |
|---|---|---|
raw |
string |
Candidate MAC address, may be null or malformed. |
result |
MacAddress? |
Canonical value object when parsing succeeded, otherwise null. |
Returns: bool