Monday 10 June 2019

C# - Check if string is an integer and if yes - assign it's value to int variable

Watch this example on YouTube

     

  string SomeValue = "33";
            int Result;
            string Message;
            if (int.TryParse(SomeValue, out Result))
            {
                Message = "it is integer";
            }
            else
            {
                Message = "no it is not";
            }

No comments:

Post a Comment