Reply to thread

Divil:


I hate to strongly disagree with a guru of .NET, but I do. Thats like saying people shouldnt use (int) or (double) or whatever to cast in C#. People coming from C++ or Java will no doubtedly cast that way while coding in C# since the syntax resemble those languages to begin with. Using a specific method to cast thats only available in a specific language is not going to hinder someone in learning a different .NET language, especially since VB.NET is the only one that even does casting like CInt() while the rest use (int) style.


Unless I am somehow using the Microsoft.VisualBasic namespace or CInt is somehow slower then Convert.ToInt16 (or whatever Int## it is) I see no reason to do needless typing. I also find CInt far more easier to read then Convert.ToInt16 or 32 or whatever ## represents an Integer.


To be honest I think VB.NET should adopt the (type) casting. I find that the easiest to use and most readable out of them all, and its also used in C#, C++ and Java.


Now if CInt etc style casting was old legacy VB6 code in the Microsoft.VisualBasic namespace then Id fully agree. Since its not (at least I hope not otherwise Im just making myself look like a fool here :eek:), its going to be supported by VB.NET probably indefinitely as its part of the language itself, just like (type) style casting is with C++, Java and C#.


Back
Top