Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1.Difference between C# 3.5 and C# 4.0 S.No 1 2 C# 3.5 C# 3.5 does not support dynamic programming.

The dynamic keyword is not recognized in C# 3.5. Dynamic variables cannot be created in C# 3.5. In C# 3.5, method parameters cannot be specified with default values. C# 3.5 does not support optional parameters. In C# 3.5, method parameters have to be specified in the same order as in method declaration in the method call. C# 3.5 does not provide named parameters. In C# 3.5, usage of ref keyword is mandatory while executing methods which are supplied by the COM interfaces. The COM objects indexed properties are not recognized in C# 3.5. Co-variance and contra-variance are not supported in Generics of C# 3.5. C# 4.0 C# 4.0 supports dynamic programming through dynamic objects. In C# 4.0, dynamic keyword is associated with objects to represent them as dynamic objects. C# 4.0 allows creation of dynamic variables. In C# 4.0, the method parameters can be specified with default values using optional parameters. C# 4.0 provides named parameters to represent the values of method parameters without following the order of declaration. In C# 4.0, usage of ref keyword is optional while executing methods which are supplied by the COM interfaces. The COM objects indexed properties are recognized in C# 4.0. C# 4.0 enhances Generics by introducing co-variance and contravariance.

3 4

2.Difference between C# and VB.NET

S.No 1

C#

VB.NET

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. In C#, an object can only be created using new. In C#, void is specified as the return type when a method does In VB.NET, an object can be created using new and CreateObject(). In VB.NET, Sub is used in method declaration to indicate that the method

2 3

not return a value. 4 5 6 In C#, no keyword is required to indicate an overloaded method. The current object is referred using this pointer in C#.

does not return any value. In VB.NET, Overloads keyword is used to indicate an overloaded method. The current object is referred as me in VB.NET.

Non virtual call cannot be made in To make a non-virtual call to the C#. current objects virtual method, MyClass is used in VB.NET. Compound data type is declared in C# using class, struct and interface. In C#, constructors are used to initialize an object. Object cleanup can be explicitly done by destructor in C#. In C#, an object is subject to asynchronous modification using volatile keyword. In C#, all the variables have to be declared before being used. In C#, default property is defined by using indexers. In C#, base class can be referred using the keyword base. Abstract class of C# can only be inherited and not instantiated. Sealed keyword of C# is used to denote that a class cannot be inherited. Division can be performed in C# using / operator. Remainder of division can be retrieved using mod operator of C#. C# does not have exponentiation operator. Compound data type is declared in VB.NET using Structure. In VB.NET, Sub New() is used to initialize the newly created object. Object cleanup can be done by using Finalize method in VB.NET. In VB.NET, an object cannot be modified in an asynchronous way. In VB.NET, variables can be forced for explicit declaration using Option Explicit. In VB.NET, default property is defined using Default. In VB.NET, base class can be referred using the keyword MyBase. MustInherit keyword of VB.NET is used to denote that a class can only be inherited and not instantiated. NotInheritable keyword of VB.NET denotes that the class cannot involve in inheritance. Division can be performed in VB.NET using \ operator. Remainder of division can be retrieved using %. In VB.NET, exponentiation can be performed using ^ operator.

8 9 10

11

12 13 14

15

16 17

18

19 20

C# has Bitwise operators namely &,| and ^. Object reference variables can be compared using == operator in C#. The short ciruit operators in C# are && (Boolean AND) and || (Boolean OR).

Bitwise operators in VB.NET are And, Or, Xor. Object reference variables can be compared using Is operator in VB.NET. The short circuit operators in VB.NET are AndAlso (Boolean AND) and OrElse (Boolean OR).

21

3.Difference between C# and C++

S.No 1 2

C# C# is a high level language that is component oriented. When compiled, C# code is converted into Intermediate language code. This intermediate language code is converted into executable code through the process called Just-In-Time compilation. In C#, memory management is automatically handled by garbage collector. In C# Switch Statement, the test variable can be a string. In C# switch statement, when break statement is not given, the fall through will not happen to the next case statement if the current case statement has any code. In addition to for, while and do..while, C# has another flow control statement called for each.

C++ C++ is a low level and indeed platform neutral programming language. When compiled, C++ code is converted into assembly language code.

In C++, the memory that is allocated in the heap dynamically has to be explicitly deleted. In C++ Switch Statement, the test variable cannot be a string. In C++ switch statement, when break statement is not given, the fall through will happen to the next case statement even if the current case statement has any code. C++ does not contain for each statement.

4 5

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. In C#, delegates, events and properties can also be specified as class members. In C++, only variables, constructors, functions, operator overloads and destructors can be class members.

Delegates, events and properties cannot be specified as class members. 9 In C#, the end of the class definition has a closing brace alone. The access modifiers in C# are public, private, protected, internal and protected internal. In C++, the end of the class definition has a closing brace followed by a semicolon. The access modifiers in C++ are public, private, protected. C++ does not have internal and protected internal access modifiers.

10

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. The exception in C# can only throw a class that is derived from the System.Exception class. The exception in C++ can throw any class.

12

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/

You might also like