uint.Parse() vs. Convert.ToUint32()
-
Question 1 (20 Marks): Compare and contrast the int.Parse() and Convert.ToUint32() methods available in the .NET Framework. Extra credit will be awarded for RTFMs ;) Seriously though, what's the differences and advantages/disadvantages between the two? Cheers, Pete
-
Question 1 (20 Marks): Compare and contrast the int.Parse() and Convert.ToUint32() methods available in the .NET Framework. Extra credit will be awarded for RTFMs ;) Seriously though, what's the differences and advantages/disadvantages between the two? Cheers, Pete
Convert.ToInt32 is actually based on ... Int32.Parse. :laugh:
public static int Convert.ToInt32(string value) {
if (value == null)
return 0;
return Int32.Parse(value);
} -
Convert.ToInt32 is actually based on ... Int32.Parse. :laugh:
public static int Convert.ToInt32(string value) {
if (value == null)
return 0;
return Int32.Parse(value);
}Thanks! I suspected that was the case (or vice versa) :laugh: So the only difference is that Convert handles nulls then? BTW, if that code the actual method within the framework, or just an example of how it's probably implemented? If it is the actual method, how did you find it?
-
Thanks! I suspected that was the case (or vice versa) :laugh: So the only difference is that Convert handles nulls then? BTW, if that code the actual method within the framework, or just an example of how it's probably implemented? If it is the actual method, how did you find it?
-
-
Or you can have a look in the shared source, nicer looking code there :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02