How to do ToInt32(string) on Micro Framework?
-
26-10-2019 - |
سؤال
Sorry for the noob question... C# is new to me.
(And reaching for basic stuff in the framework and finding it missing is a little disorienting.)
The question:
On the 4.1 .NET Micro Framework, how do I implement ToInt32(string), since the native .net micro framework lacks these conversion functions?
Thank you !
المحلول
The .NET Micro Framework (at least, version 3.0 and above) has an Int32.Parse
method which will do what you want: convert a string representation of a number into the actual integer equivalent.
The documentation for that method is here.
Call it like this:
String myString = "100";
Int32 myNumber = Int32.Parse(myString);
But it looks like the .NET Micro Framework (again, version 3.0 and above) also provides the Convert
class, including various overloads of methods such as ToInt32
and ToDouble
, so I'm not really sure what the problem is and why you say that it "lacks these conversion functions". Which ones are missing?