1.Difference between C# 3.5 and C# 4.0

      S.No   C# 3.5                               C# 4.0

      1      C# 3.5 does not support dynamic      C# 4.0 supports dynamic programming
             programming.                         through dynamic objects.

      2      The dynamic keyword is not           In C# 4.0, dynamic keyword is
             recognized in C# 3.5.                associated with objects to represent
                                                  them as dynamic objects.

      3      Dynamic variables cannot be          C# 4.0 allows creation of dynamic
             created in C# 3.5.                   variables.

      4      In C# 3.5, method parameters         In C# 4.0, the method parameters can
             cannot be specified with default     be specified with default values using
             values. C# 3.5 does not support      optional parameters.
             optional parameters.

      5      In C# 3.5, method parameters         C# 4.0 provides named parameters to
             have to be specified in the same     represent the values of method
             order as in method declaration in    parameters without following the order
             the method call. C# 3.5 does not     of declaration.
             provide named parameters.

      6      In C# 3.5, usage of ref keyword is   In C# 4.0, usage of ref keyword is
             mandatory while executing            optional while executing methods
             methods which are supplied by        which are supplied by the COM
             the COM interfaces.                  interfaces.

      7      The COM object’s indexed             The COM object’s indexed properties
             properties are not recognized in     are recognized in C# 4.0.
             C# 3.5.

      8      Co-variance and contra-variance      C# 4.0 enhances Generics by
             are not supported in Generics of     introducing co-variance and contra-
             C# 3.5.                              variance.


2.Difference between C# and VB.NET


      S.No   C#                                   VB.NET

      1      In C#, variables are declared using In VB.NET, the variables are declared
             declarators.                        using keywords such as private,
                                                 protected, friend, public, static, shared
                                                 and Dim.

      2      In C#, an object can only be         In VB.NET, an object can be created
             created using new.                   using new and CreateObject().

      3      In C#, void is specified as the      In VB.NET, Sub is used in method
             return type when a method does       declaration to indicate that the method
not return a value.                   does not return any value.

4    In C#, no keyword is required to      In VB.NET, Overloads keyword is
     indicate an overloaded method.        used to indicate an overloaded method.

5    The current object is referred        The current object is referred as me in
     using this pointer in C#.             VB.NET.

6    Non virtual call cannot be made in To make a non-virtual call to the
     C#.                                current object’s virtual method,
                                        MyClass is used in VB.NET.

7    Compound data type is declared        Compound data type is declared in
     in C# using class, struct and         VB.NET using Structure.
     interface.

8    In C#, constructors are used to       In VB.NET, Sub New() is used to
     initialize an object.                 initialize the newly created object.

9    Object cleanup can be explicitly      Object cleanup can be done by using
     done by destructor in C#.             Finalize method in VB.NET.

10   In C#, an object is subject to        In VB.NET, an object cannot be
     asynchronous modification using       modified in an asynchronous way.
     volatile keyword.

11   In C#, all the variables have to be   In VB.NET, variables can be forced for
     declared before being used.           explicit declaration using Option
                                           Explicit.

12   In C#, default property is defined    In VB.NET, default property is defined
     by using indexers.                    using Default.

13   In C#, base class can be referred     In VB.NET, base class can be referred
     using the keyword ‘base’.             using the keyword ‘MyBase’.

14   Abstract class of C# can only be      MustInherit keyword of VB.NET is
     inherited and not instantiated.       used to denote that a class can only be
                                           inherited and not instantiated.

15   Sealed keyword of C# is used to       NotInheritable keyword of VB.NET
     denote that a class cannot be         denotes that the class cannot involve in
     inherited.                            inheritance.

16   Division can be performed in C#       Division can be performed in VB.NET
     using / operator.                     using  operator.

17   Remainder of division can be          Remainder of division can be retrieved
     retrieved using mod operator of       using %.
     C#.

18   C# does not have exponentiation       In VB.NET, exponentiation can be
     operator.                             performed using ^ operator.
19     C# has Bitwise operators namely       Bitwise operators in VB.NET are And,
            &,| and ^.                            Or, Xor.

     20     Object reference variables can be     Object reference variables can be
            compared using == operator in         compared using Is operator in
            C#.                                   VB.NET.

     21     The short ciruit operators in C#      The short circuit operators in VB.NET
            are && (Boolean AND) and ||           are AndAlso (Boolean AND) and
            (Boolean OR).                         OrElse (Boolean OR).

3.Difference between C# and C++


     S.No   C#                                    C++

     1      C# is a high level language that is   C++ is a low level and indeed platform
            component oriented.                   neutral programming language.

     2      When compiled, C# code is             When compiled, C++ code is
            converted into Intermediate           converted into assembly language
            language code. This intermediate      code.
            language code is converted into
            executable code through the
            process called Just-In-Time
            compilation.

     3      In C#, memory management is           In C++, the memory that is allocated in
            automatically handled by garbage      the heap dynamically has to be
            collector.                            explicitly deleted.

     4      In C# Switch Statement, the test      In C++ Switch Statement, the test
            variable can be a string.             variable cannot be a string.

     5      In C# switch statement, when          In C++ switch statement, when break
            break statement is not given, the     statement is not given, the fall through
            fall through will not happen to the   will happen to the next case statement
            next case statement if the current    even if the current case statement has
            case statement has any code.          any code.

     6      In addition to for, while and         C++ does not contain for each
            do..while, C# has another flow        statement.
            control statement called for each.

     7      C# struts can contain only value   C++ struts behave like classes except
            types. The struts is sealed and it that the default access is public instead
            cannot have a default no-argument of private.
            constructor.

     8      In C#, delegates, events and          In C++, only variables, constructors,
            properties can also be specified as   functions, operator overloads and
            class members.                        destructors can be class members.
Delegates, events and properties
                                                    cannot be specified as class members.

      9      In C#, the end of the class            In C++, the end of the class definition
             definition has a closing brace         has a closing brace followed by a
             alone.                                 semicolon.

      10     The access modifiers in C# are         The access modifiers in C++ are
             public, private, protected, internal   public, private, protected. C++ does
             and protected internal.                not have internal and protected internal
                                                    access modifiers.

      11     C# has finally block in exception    C++ does not have finally block in
             handling mechanism. The code         exception handling mechanism.
             statements in the finally block will
             be executed once irrespective of
             exception occurrence.

      12     The exception in C# can only           The exception in C++ can throw any
             throw a class that is derived from     class.
             the System.Exception class.

      13     C# does not have the concept of     C++ has the concept of function
             function pointers. C# has a similar pointers.
             concept called Delegates.

Please visit my blog @ http://onlydifferencefaqs.blogspot.in/

CSharp difference faqs- 1

  • 1.
    1.Difference between C#3.5 and C# 4.0 S.No C# 3.5 C# 4.0 1 C# 3.5 does not support dynamic C# 4.0 supports dynamic programming programming. through dynamic objects. 2 The dynamic keyword is not In C# 4.0, dynamic keyword is recognized in C# 3.5. associated with objects to represent them as dynamic objects. 3 Dynamic variables cannot be C# 4.0 allows creation of dynamic created in C# 3.5. variables. 4 In C# 3.5, method parameters In C# 4.0, the method parameters can cannot be specified with default be specified with default values using values. C# 3.5 does not support optional parameters. optional parameters. 5 In C# 3.5, method parameters C# 4.0 provides named parameters to have to be specified in the same represent the values of method order as in method declaration in parameters without following the order the method call. C# 3.5 does not of declaration. provide named parameters. 6 In C# 3.5, usage of ref keyword is In C# 4.0, usage of ref keyword is mandatory while executing optional while executing methods methods which are supplied by which are supplied by the COM the COM interfaces. interfaces. 7 The COM object’s indexed The COM object’s indexed properties properties are not recognized in are recognized in C# 4.0. C# 3.5. 8 Co-variance and contra-variance C# 4.0 enhances Generics by are not supported in Generics of introducing co-variance and contra- C# 3.5. variance. 2.Difference between C# and VB.NET S.No C# VB.NET 1 In C#, variables are declared using In VB.NET, the variables are declared declarators. using keywords such as private, protected, friend, public, static, shared and Dim. 2 In C#, an object can only be In VB.NET, an object can be created created using new. using new and CreateObject(). 3 In C#, void is specified as the In VB.NET, Sub is used in method return type when a method does declaration to indicate that the method
  • 2.
    not return avalue. does not return any value. 4 In C#, no keyword is required to In VB.NET, Overloads keyword is indicate an overloaded method. used to indicate an overloaded method. 5 The current object is referred The current object is referred as me in using this pointer in C#. VB.NET. 6 Non virtual call cannot be made in To make a non-virtual call to the C#. current object’s virtual method, MyClass is used in VB.NET. 7 Compound data type is declared Compound data type is declared in in C# using class, struct and VB.NET using Structure. interface. 8 In C#, constructors are used to In VB.NET, Sub New() is used to initialize an object. initialize the newly created object. 9 Object cleanup can be explicitly Object cleanup can be done by using done by destructor in C#. Finalize method in VB.NET. 10 In C#, an object is subject to In VB.NET, an object cannot be asynchronous modification using modified in an asynchronous way. volatile keyword. 11 In C#, all the variables have to be In VB.NET, variables can be forced for declared before being used. explicit declaration using Option Explicit. 12 In C#, default property is defined In VB.NET, default property is defined by using indexers. using Default. 13 In C#, base class can be referred In VB.NET, base class can be referred using the keyword ‘base’. using the keyword ‘MyBase’. 14 Abstract class of C# can only be MustInherit keyword of VB.NET is inherited and not instantiated. used to denote that a class can only be inherited and not instantiated. 15 Sealed keyword of C# is used to NotInheritable keyword of VB.NET denote that a class cannot be denotes that the class cannot involve in inherited. inheritance. 16 Division can be performed in C# Division can be performed in VB.NET using / operator. using operator. 17 Remainder of division can be Remainder of division can be retrieved retrieved using mod operator of using %. C#. 18 C# does not have exponentiation In VB.NET, exponentiation can be operator. performed using ^ operator.
  • 3.
    19 C# has Bitwise operators namely Bitwise operators in VB.NET are And, &,| and ^. Or, Xor. 20 Object reference variables can be Object reference variables can be compared using == operator in compared using Is operator in C#. VB.NET. 21 The short ciruit operators in C# The short circuit operators in VB.NET are && (Boolean AND) and || are AndAlso (Boolean AND) and (Boolean OR). OrElse (Boolean OR). 3.Difference between C# and C++ S.No C# C++ 1 C# is a high level language that is C++ is a low level and indeed platform component oriented. neutral programming language. 2 When compiled, C# code is When compiled, C++ code is converted into Intermediate converted into assembly language language code. This intermediate code. language code is converted into executable code through the process called Just-In-Time compilation. 3 In C#, memory management is In C++, the memory that is allocated in automatically handled by garbage the heap dynamically has to be collector. explicitly deleted. 4 In C# Switch Statement, the test In C++ Switch Statement, the test variable can be a string. variable cannot be a string. 5 In C# switch statement, when In C++ switch statement, when break break statement is not given, the statement is not given, the fall through fall through will not happen to the will happen to the next case statement next case statement if the current even if the current case statement has case statement has any code. any code. 6 In addition to for, while and C++ does not contain for each do..while, C# has another flow statement. control statement called for each. 7 C# struts can contain only value C++ struts behave like classes except types. The struts is sealed and it that the default access is public instead cannot have a default no-argument of private. constructor. 8 In C#, delegates, events and In C++, only variables, constructors, properties can also be specified as functions, operator overloads and class members. destructors can be class members.
  • 4.
    Delegates, events andproperties cannot be specified as class members. 9 In C#, the end of the class In C++, the end of the class definition definition has a closing brace has a closing brace followed by a alone. semicolon. 10 The access modifiers in C# are The access modifiers in C++ are public, private, protected, internal public, private, protected. C++ does and protected internal. not have internal and protected internal access modifiers. 11 C# has finally block in exception C++ does not have finally block in handling mechanism. The code exception handling mechanism. statements in the finally block will be executed once irrespective of exception occurrence. 12 The exception in C# can only The exception in C++ can throw any throw a class that is derived from class. the System.Exception class. 13 C# does not have the concept of C++ has the concept of function function pointers. C# has a similar pointers. concept called Delegates. Please visit my blog @ http://onlydifferencefaqs.blogspot.in/