Re: C# Vs VB.NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Thu, 31 Mar 2005 06:58:38 +0100, Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
wrote:

> <"=?Utf-8?B?U2FyYXRoIEJhYnU=?=" <Sarath
> Babu@xxxxxxxxxxxxxxxxxxxxxxxxx>> wrote:
> > Can anyone let me know why most companies prefer C# when the same task can
> > be accomplished using VB.NET in a simpler and easier way..?
>
> Perhaps because your idea of simpler and easier isn't theirs?

The question is who is wrong.

Neither and both, IMO: C# will be easier for C/C++ and Java developers,
VB.Net will be preferred by those who were used to VB6.

VB requires some more typing, but I find that makes the result more
readable. I've seen C/C++/C# code where almost every } is followed by a
comment to indicate what statement it belongs to, VB is self-documenting in
that regard.

In the DirectX SDK you find sample code for VB and C# that only differs in
syntax, where program structure and even comment text are fully identical
because it was written in one language and then simply syntax-translated to
the other. Translation can usually be done line by line, keyword by
keyword (the most work is C# to VB, finding the right } and replacing it by
the right keyword each time).

> Personally I find C# simpler, partly because as a language it's so much
> smaller, without all the legacy functions that VB.NET carries around
> with it.

Legacy functions are an extension you don't have to use.
Just leave Microsoft.Visualbasic.Compatibility out.


> I suspect if I used VB.NET regularly, the thing I'd miss most from C#
> is the "using" statement - it's so much easier to write
>
> using (Stream s = ...)
> {
> ...
> }
>
> than manually putting the try/finally in the right place.

I don't see the relation to exception handling, or else I missed something
in C# (I haven't used it much).

The VB equivalent is
With s As Stream = ...
...
End With
Different syntax, exact same thing (AFAIK).

.



Relevant Pages

  • Re: Working on new language
    ... I'll make sure to put some warts in the language:) ... syntax to me is misguided. ... So apart from the "so" keyword mentioned below I require ... It would be possible to separate arguments with commas, but the opens ...
    (comp.lang.misc)
  • Re: C# Vs VB.NET
    ... some such as me even from a BASIC-only background. ... Translation can usually be done line by line, keyword by ... > Legacy functions are an extension you don't have to use. ... > Different syntax, exact same thing. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: new Java lambda syntax
    ... this would probably not have been my first choice (my own language uses the syntax "fun(args...) body"). ... I can't really fault the Java people either (and also introducing a new keyword is not free). ... I wouldn't blame them too much (Java doesn't have a whole lot of good choice WRT reserved words which could be overloaded here). ...
    (comp.lang.java.programmer)
  • Re: What is the reason for this syntax?
    ... totally agree on the 'elsif' keyword. ... I actually thought ruby did this already--had to write a little script ... the syntax of the language itself. ...
    (comp.lang.ruby)
  • Re: Looking for volunteers for XL
    ... the form of a notation in an extensible language ... Similarly, in XL, tree rewrites are easily ... XL does not encourage syntax changes. ...
    (comp.compilers)