.NET Type | C# keyword | PowerShell literal suffix |
System.SByte , System.Byte | sbyte , byte | y , uy |
System.Int16 , System.UInt16 | short , ushort | s , us |
System.Int32 , System.UInt32 | int , uint | u (none for System.UInt32 ???) |
System.Int64 , System.UInt64 | long , ulong | l , ul |
System.IntPtr , System.UIntPtr | nint , nuint |
[Uint32]::Parse('abcd', [System.Globalization.NumberStyles]::AllowHexSpecifier)
System.Convert.FromHexString
System.Convert
provides a few To…()
methods that allow to convert to integral types, as is demonstrated with the following PowerShell statements: [System.Convert]::ToUInt64(' 42 ') [System.Convert]::ToUInt64('fedcba9876543210', 16) # Hexadecimal to Uint64