Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between C# and VB.Net

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 87
    Comment on it
     C#  CB.Net

     1. It contains a “using” keyword to release unmanaged code.

     1. It doesn't contains a “using” keyword.

     2. It doesn't support the optional parameter.

     2. It contains a “Optional” keyword to support the optional parameter.

     

     3. It doesn't supports unstructured error handling.

     

     3. It supports both structure and unstructured error handling.

     

    4. It is a case sensitive language.

     

    4. It is not a case sensitive language.

     

     5. In C#, declaring a variables as follows:

       int y;

       int y = 10;

     

     5. In VB.Net, declaring a variables as follows:

            Dim y As Integer

            Public y As Integer = 10

     

     6. In C# syntax for comment:

     

           // comment

            /* multiline

              comment */

     

     6. In VB.Net, syntax for comment:

         ' comment

           x = 1 ' comment

           Rem comment

     

     

     7. In C#, object variable that does not refer to an object:

    object obj=null;

     

     7. In VB.Net, object variable that does not refer to an object :

    object obj=Nothing;

     

     8. In C#, structure for Exception handling :

     try

     {

     if (y == 0)

         throw new System.Exception( "y equal to zero");

     else

        throw new System.Exception( "y does not equal to  zero");

     }

     catch (System.Exception e)

     {

      System.Console.WriteLine(e.Message);

     }

     finally

     {

        System.Console.WriteLine(" finally block is  executing");

     }

     

     8. In VB.Net, structure for Exception handling :

     try

     If y = 0 Then

         Throw New Exception( _ "y equal to zero")

     Else

        Throw New Exception( _ "y does not equal to  zero")

     End If

       Catch e As System.Exception MsgBox( _"Error: " & E.Description)

     Finally

         MsgBox( _ "finally block Executing")

     End Try

     

     

     

     9. In C#, syntax for declaring an array:

          int[] y = new int[5];

     

     

     9. In VB.Net, syntax for declaring an array:

         Dim y() As Long

     

     10. In C#, for creating a new object we use “new” keyword.

     

     

    10. In VB.Net, for creating a new object we use

       New, CreateObject().

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: