CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2003
    Posts
    5

    Question ...:::::: C# or VB .NET ::::::...

    Hi friends,

    With the recent (and powerful) language C#, do you still with VB (i mean, VB. Net), or will try to use C#?

    I have read many things about it, and many guys think that VB programmers will try to change to C#.

    What do you think about it?

    See you ...

  2. #2
    Join Date
    Jul 2002
    Location
    .NET 2.0/.NET 3.0/.NET 3.5 VS2005/VS2008
    Posts
    284
    I definitly recommend C#, but VB.NET is nice to learn with and you can always switch to C#. You can even use the controls and classes created in VB.NET in C# and visaversa.
    WM.

    What about weapons of mass construction?

  3. #3
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    sure here are some advantages of both. both has same fundamental things to offer towards .NET architecture but they have some differences also.
    although finnally what matters at the end of the day is how you achieve your project goals. since its a .NET and on CLR layer so you could select any .NET languages as you want but personely I preffer C# over VB since it looks similliar to C++ :-)))

    [I have taken this article from one of the sites i found - which doesn't mean for you to select lang. at looking at the bright advantages in first place. think about in details first before selecting the language]


    Advantages of VB.NET :-
    ---------------------------

    VB.NET has features that C# doesn't. For example, the IsDBNull() function is in VB.NET, but not in C#. VB.NET has exponentiation and can re-allocate arrays using Redim; these aren't available in C#. C# is case-sensitive for keywords and variables. Most Visual Basic programmers aren't used to this, and this can cause lost time unless you're really consistent in your typing. Select Case statements are easier and more compact than in C#. In C#, you have to use the break statement all the time to break out of the select structure. In Visual Basic, you can use Case 1 to 50: In C#, you have to code 50 individual case statements for this.

    example (VB is easier to understand for novice bies also who has never touched dos/assembley/C++ etc)

    Public Class Person
    ...
    End Class
    Public Class Employee
    Inherits Person
    ...
    End Class

    Here's the same code in C#:

    public class Person
    {
    public Person() {
    ...
    }
    }
    public class Employee : Person
    {
    public Employee() {
    ...
    }
    }



    Now something about C#,
    Microsoft had a couple of goals in mind when they created C#. First, they needed an alternative to Java. With their constant court battles over this language, and most people viewing Java as a Sun product, Microsoft needed their own language that was similar to Java, but distinctly their own. In addition, Microsoft wanted a new, clean language that didn't have any legacy code that users still needed to maintain. The result is a clean language, without a lot of baggage.



    Advantages of C#

    the ability to have multi-line comments without having to repeat the comment character is pretty slick. C# can also do pre- and post-incrementing and decrementing, for example:

    intValue--
    intValue-

    The first line in the above code increments the variable intValue by one. The second line decrements the variable by one. This is a nice shorthand compared to the more lengthy Visual Basic version of intValue += 1.
    Another benefit of C# is that there are currently more sample programs in the beta version than there are samples in VB.NET.

    Although not often used for business applications,
    C# lets you have pointers.

    so C# is strong towards Object Oriented Constructs.

    [The following lines which I liked the most]
    C# has the ability to use the Unsigned data types defined in the .NET runtime. Again, the need for this in a business application isn't common, but it is an area where C# has more access to the .NET runtime engine than VB.NET.
    - Software Architect

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    VB:
    - VB support late-binding to objects directly, which requires more work to do in C#.
    - VB automatically wires events to appropriate event names, but that has to be done explicitly in C#.
    - VB allows default parameters values for methods.


    C#:
    -C# allows you to write "unsafe" managed code in case you need to manipulate pointers in a
    manner similar to C++.
    -C# allows you to use XML Documentation.
    This is a specific format for commenting you
    classes/methods/properties etc.. If you follow the instructions you
    can generate XML Document which can be translated to HTML using XSLT,
    or create a web site displaying the comments, or convert it to the MSDN
    format (CHM file) using a free tool.
    -C# allows operator overloading ( not sure abt VB.NET tho)
    -C# much cleaner code



    there is a book available for making a decision btw. C#/VB

    http://www.amazon.com/exec/obidos/AS...244164-0550554


    Thanx
    Paresh
    - Software Architect

  5. #5
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    And, think about Core C++ and ATL syntax...
    It is concidered to be one of the most criptic syntaxes amongst all languages. (Even assembley language has a mov ax,bx which is easy to understand ofcourse one must be technical and do understand the bit-and-bytes of processers)

    But C++ templates ! Oh ! very ugly, to debug and maintain , it becomes nightmare when a strong programmer writes some large code and application depends upon that and suddenly runs away and the bugs are revealed.... Junior programer adds more bugs in it and finnaly the product stops.

    So, I think C# is better than these all issues. Supports OOP and its more towards .NET assemblers.
    - Software Architect

  6. #6
    Join Date
    Jul 2002
    Location
    .NET 2.0/.NET 3.0/.NET 3.5 VS2005/VS2008
    Posts
    284
    Unmanaged code can also be used in vb.net, so to that point there are no differences. Also pointers are possible in vb.net it also knows delegates and pointers to variables and datatypes

    like this:

    [code]
    Class Person
    Public Sub Add(byval Name as string, byref isOK as boolean)
    if name is nothing then
    isOK = false
    end if
    End Sub

    Public Delegate Sub OnCreate()
    End Class
    WM.

    What about weapons of mass construction?

  7. #7
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    yes, I could have deleted the COMMON part
    - Software Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured