Thursday, July 30, 2009

What does int. Parse mean?

Im learning C# and wonder what int.Parse means.

What does int. Parse mean?
int. Parse converts the specified string representation of a number to its 32-bit signed integer equivalent.
Reply:Their are a variety of Parse methods for primitive types (Int32, Single, Currency). What these methods do is, given a String object, they will return the type-specific value of that String. So if I had the String "3.14159" and I did





String myString = "3.14159";


float value = Single.Parse(myString);





value would be equal to 3.14159 (approximately). This is useful for example if a textbox contains a numeric value to extract the numeric value from it.
Reply:It's a function that allows you to convert a string, lets say "123" into an integer number.


No comments:

Post a Comment