I don't really prefer either language, but I do prefer the VB editor in Visual Studio, mainly due to the automatic indenting and stuff. I find that I have to go back and use 'format selection' in C# way more often then in VB (and before I knew about 'format selection' I did it manually!). The C# does have some automatic indenting, but mainly when you type a closing brace or parentheses. In VB, it's pretty hard to actually get it to miss-align something even if you try!
I do prefer VB's syntax over C# in most of the newer features such as
Not sure why but I feel it's easier to read, as with most of VB since it's much more "wordy" then the minimalistic C#.Code:messageTarget = Function(s) ShowWindowsMessage(s) 'VB messageTarget = s => ShowWindowsMessage(s); // C#
The only thing I dislike about VB's syntax is the Dim statementIt looks so ugly! I don't think using C#'s syntax for declaring variables is too minimal, and it would work well for VB too:
I think it looks ok, better then 'Dim' at least... Ugh.Code:String s = "Test" Private Integer i = 3 Protected List(Of Integer) numbers = New List(Of Integer) From {1, 2, 3, 4, 5} ' "modified" For Each For Each Integer int In numbers MessageBox.Show(int.ToString) Next ' "normal" For Each could still work too, but may be confusing as the order is reversed now suddenly For Each int As Integer in numbers ... Next
What I do like about C# is that it enforces rules such as when the use parentheses much better. In C# for example, when you declare a new instance of a class you must use parentheses:
Whereas in VB you can leave them out if you want. I like consistency so I always try to write 'C# style' in VB, using parentheses where it would be required in C# even though I'm using VB.Code:Button btn = new Button();




It looks so ugly! I don't think using C#'s syntax for declaring variables is too minimal, and it would work well for VB too:
Reply With Quote