在c#中将字符串(十六进制格式)复制到ulong

moh*_*108 1 .net c#

我需要将十六进制格式的字符串元素复制到 ulong。

例子:

string s = "0x4E45565251554954";     // already in hex format

ulong t;     // this ulong should be t=0x4E45565251554954.
Run Code Online (Sandbox Code Playgroud)

And*_*tar 5

或者:

string s = "0x4E45565251554954";
ulong t = Convert.ToUInt64(s, 16);
Run Code Online (Sandbox Code Playgroud)