Useful++


It’s often the case that i need (or want) to see how something is done inside VB.  However, whenever i start editing in VB i realize how much the language confuses me and how i’m always tripping up over the language.  As a tribute to the VB team, the work they’ve done in 2005 to help correct your mistakes is incredibly helpful, however i still run into problems.  Luckily, there’s now a service available that will translate C# to VB (or vice versa) on the fly.  i.e. as you’re typing in C# the equivalent VB is shown below.  Very very helpful for when you’ve forgotten exactly how a certain language construct works in the opposite language.  Now all i need is a new version that output to the new managed C++ syntax which i’m always forgetting.


            


The tool is available here: http://www.carlosag.net/Tools/CodeTranslator/Default.aspx


Comments (5)

  1. Joku says:

    Yeah. I would also add that VB developers must be more better in parsing code with their eyes. I do not really mind for the ; but the { } just make it so much easier for me to see the scope as its not drown in the verbosity.

  2. CyrusN says:

    Joku: "Yeah. I would also add that VB developers must be more better in parsing code with their eyes. I do not really mind for the ; but the { } just make it so much easier for me to see the scope as its not drown in the verbosity. "

    Agreed, although the VB style makes some things much easier. For example, if you have the following C# code:

    class C

    {

    ….void Foo()

    ….{

    } //<– there are two ways to interpret this close curly

    class D

    {

    }

    And, depending on how you interpret it it will change how intellisense works. For example, if we treat the close curly as belonging to the method, then that makes D a nested type. If you treat it as belonging to class C, then class D becomes a sibling type.

    This is a rather interesting problem and gets into the complicated area of error tolerance and recovery.

    In VB this is much simpler because of the explicitness of what construct you are ending (XML also has this nice property). So if you had:

    Public Class Some

    ….Public Sub New()

    ‘ <– right here they can offer to add in "End Sub"

    End Class

    Public Class None

    End Class

    Which can be rather nice.

  3. Brendan says:

    Does this mean that C# is going to support indexed properties in 05?

  4. CyrusN says:

    Brendon: "Does this mean that C# is going to support indexed properties in 05? "

    There is a snippet included in VS2005 that will allow you to make named indexers in C# if that’s something you’d like to do.

  5. Hey Cyrus

    I love your blog. Please be careful with banding about the word "useful" with software!

    We have used youseful software since 1996. Youseful++ is not a term to us. In fact we had to write MSN about their slogan "More useful everyday"!

    Joe Mele