C# and VB.NET comparison

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frank McCown

    C# and VB.NET comparison

    I've created a quick reference comparison of C# and
    VB.NET that you might find useful. I couldn't find
    anything like it on the web and so I made my own.


    rison.html

    It doesn't cover every area of the languages, just those
    features most frequently used.

    I also created a Java and C# comparison:


    ison.html

    I'd be thankful for any suggestions you may have on ways
    to improve the comparisons.

    Thanks,
    Frank
  • Jon Skeet [C# MVP]

    #2
    Re: C# and VB.NET comparison

    Frank McCown <mccownf@yahoo. com> wrote:[color=blue]
    > I also created a Java and C# comparison:
    >
    > http://www.harding.edu/USER/fmccown/..._csharp_compar
    > ison.html
    >
    > I'd be thankful for any suggestions you may have on ways
    > to improve the comparisons.[/color]

    You've fallen into the "objects are passed by reference" trap for Java
    and C#. Please read
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    I can't remember offhand whether or not Java is getting variable
    parameter lengths in 1.5, but it may well be.

    Picky things:

    o Constants in Java are usually declared to be static. (It's implicit
    in C#)

    o Under enumerations, I believe the preferred order for modifiers is
    "public static final int", although it doesn't matter too much. It
    might also be worth mentioning that Java is getting enumerations in
    1.5.

    o Under arrays, in Java you can write:
    int[][] x = new int[5][3];
    but you can't do the same thing (with jagged arrays) in C#.

    o Under foreach, it may be worth mentioning that Java is getting
    foreach (in the form "for x : collection") in 1.5. The usual equivalent
    of foreach would be done using an Iterator though.

    o Under "choices", your code would give a warning under Java 1.4 (due
    to the fallthrough).

    o Under exception handling, not only is the argument itself entirely
    optional in C#, but you can also get rid of *just* the variable name.
    It would also be worth mentioning that C# (and .NET in general) doesn't
    have checked exceptions.

    o Under namespaces, your import statement is incorrect in Java - it
    should either be "import Harding.Compsci .Graphics.*;" or
    "import Harding.Compsci .Graphics.Class Name;". You might also want to
    change the package name to "harding.compsc i.graphics" to follow Java
    conventions for the Java version.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...