In VB.NET CINT(VB.NET) is Integer.Parse in .NET Framework, what is the .NET equivalent for (VB.NET) CType?
In VB.NET CINT(VB.NET) is Integer.Parse in .NET Framework, what is the .NET equivalent for
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
CTypeis translated to a cast, which is a language level issue. In the emitted IL, there is no such thing as casting anobjectto astring, for instance. (Side note: if the type is a value type, it’ll translate to anunboxinstruction, but it’s another story; The runtime does not distinguish between a reference toFooandBarreference types at all, for the sake of simplicity, I also ignored throwingInvalidCastExceptionwhich is done by thecastclassinstruction).Integer.ParseandCIntbasically do some process on the source object (the string) and convert it to an equivalent integer. They do something.CTypejust instructs the language compiler about the type conversion.For the sake of completeness, the IL equivalent of casting is:
castclassif the type is a reference type.unboxif the type is a value type.However, the Visual Basic compiler, translates the expression to a call to one of the
Microsoft.VisualBasic.CompilerServices.Conversionsmethods.