what is ctype ???
what is ctype ?
Collapse
X
-
-
CType is used for when you want to Cast an object of a Type into a different Type in VB.NET
In C# it's much easier. If you want to cast something into something else then you would just use:
This syntax cannot be used in VB.NET (probably because it uses brackets for so many things...arrays , functions etc) So, in VB.NET you either use the CType method or the DirectCast method to cast between object types:Code:Integer i; i = 5; Double j; j = (Double) i;
Code:Dim i As Integer i = 5 Dim j As Double = Ctype(i, Double)
All the information you need on the CType method and any other .NET controls can be found in the MSDN Library. There are multiple articles on the CType Function there. I recommend bookmarking the MSDN Library and using it as your primary resource when developing in .NET.
See How to: Define a Conversion Operator for a walk through on how to define a CType conversion operator (properly create the CType method) for your own custom classes!
-FrinnyComment
Comment