src/extensions/looseassembly/Client/PublicKeyToken.cs
/// <summary>
/// Creates a PublicKeyToken from a 16-hex-character string representation.
/// </summary>
Creates a PublicKeyToken from a 16-hex-character string representation.
Creates a PublicKeyToken from a 16 - hex - character string representation .
public static PublicKeyToken FromPktString(string pkt)
        {
            if (pkt is null)
            {
                throw new ArgumentNullException(nameof(pkt));
            }
            if (pkt.Length != 16)
            {
                throw new InvalidOperationException("The key length is not even");
            }
            var pktSpan = pkt.AsSpan();
            var bytes = new byte[8];
            for (var i = 0; i < bytes.Length; i++)
            {
                bytes[i] = byte.Parse(pktSpan.Slice(0, 2), System.Globalization.NumberStyles.HexNumber);
                pktSpan = pktSpan[2..];
            }
            return new PublicKeyToken(bytes);
        }
public static PublicKeyToken FromPktString ( string pkt ) { if ( pkt is null ) { throw new ArgumentNullException ( nameof ( pkt ) ) ; } if ( pkt . Length != 16 ) { throw new InvalidOperationException ( " " ) ; } var pktSpan = pkt . AsSpan ( ) ; var bytes = new byte [ 8 ] ; for ( var i = 0 ; i < bytes . Length ; i ++ ) { bytes [ i ] = byte . Parse ( pktSpan . Slice ( 0 , 2 ) , System . Globalization . NumberStyles . HexNumber ) ; pktSpan = pktSpan [ 2 .. ] ; } return new PublicKeyToken ( bytes ) ; }
Creates a PublicKeyToken from a 16-hex-character string representation.
Creates a PublicKeyToken from a 16 - hex - character string representation .
pkt
string