What is the difference between using ToString and ToString() in VB.NET?
+18
A:
Nothing. VB.NET allows you exclude the parentheses on any method that doesn't take in an argument.
Charles Graham
2008-12-24 02:45:02
Exactly the right answer, good practice would be to go ahead and get used to those parentheses and add them in, as if you do any cross language development in .Net (pretty common for anyone using VB.Net) it is easier not to forget them if you already use them.
Tom Anderson
2008-12-24 02:52:57
Agreed, VB.net allows you to be pretty lazy and not use best practices. Im not sure if the omission of parans is valid if option strict is set?
schmoopy
2008-12-24 03:28:22
I sometimes wish I could do that In C#. I find empty parentheses annoying.
chaiguy
2008-12-24 04:51:22
Empty parenthases are there for a reason! It let's you know the differance between a property (or public feild) and a method on the class.
Charles Graham
2008-12-24 04:53:29
The D programming language lets you omit parentheses, and goes one step further in that it lets you assign to functions taking one parameter: a = 10; is a(10);
Johannes Schaub - litb
2008-12-24 05:21:40
@Charles. That's silly, it doesn't matter if it is a property or method when you are reading it.
Jonathan Allen
2009-10-22 18:51:09