Answers for "c sharp try cast string int"

C#
2

how to convert string to int in c#

string a = ("2");
int b = Convert.ToInt16(a)
Posted by: Guest on September-05-2020
1

c# convert string to int

int number;
bool result = int.TryParse("12345", out number);
if(result)
                {
                    // Do whatever.
                }
                else
                {
                    // Failed to parse.
                }
Posted by: Guest on September-11-2020

C# Answers by Framework

Browse Popular Code Answers by Language