string s = "-1"; // или другое отриц. uint u = uint.Parse(s); // uint u = Convert.ToUInt32(s); Overflow anyway.
string s = "-1"; // или другое отриц. uint u = uint.Parse(s); // uint u = Convert.ToUInt32(s); Overflow anyway.
Well, for starters, it's worth reading what uint . There is a range of values from 0 to 4,294,967,295 ( MSDN ). When converting a number outside the range of values to the desired type - the resulting number will be distorted / lost. If you are not worried about the possible loss of value - use an explicit type conversion:
uint a = 123; int b = (int)a; Source: https://ru.stackoverflow.com/questions/630015/
All Articles