Skip to content

Instantly share code, notes, and snippets.

@huihut
Created September 13, 2018 07:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huihut/4aac927e1e5b308db0f4b73ecbcb0e03 to your computer and use it in GitHub Desktop.
Save huihut/4aac927e1e5b308db0f4b73ecbcb0e03 to your computer and use it in GitHub Desktop.
CSharp type conversion
# Website: http://www.convertdatatypes.com/Language-CSharp.html
# Convert string to bool
string vIn = "true";
bool vOut = Convert.ToBoolean(vIn);
# Convert string to int
string vIn = "0";
int vOut = Convert.ToInt32(vIn);
# Convert string to uint
string vIn = "0";
uint vOut = Convert.ToUInt32(vIn);
# Convert string to long
string vIn = "0";
long vOut = Convert.ToInt64(vIn);
# Convert string to ulong
string vIn = "0";
ulong vOut = Convert.ToUInt64(vIn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment