- Generics - The .NET Framework class library contains several new generic collection classes in the System.Collections.Generic namespace. These should be used whenever possible in place of classes such as ArrayList in the System.Collections namespace.
- Iterators - make it easier to dictate how a foreach loop will iterate over a collection's contents.The yield keyword is used to specify the value, or values, returned. When the yield return statement is reached, the current location is stored. Execution is restarted from this location the next time the iterator is called. You can use more than one yield statement in the same iterator
- Partial Classes - Partial type definitions allow a single type, such as a class, to be split into multiple files. The Visual Studio designer uses this feature to separate its generated code from user code.
- Nullable Types - Nullable types allow a variable to contain a value that is undefined. Nullable types are useful when working with databases and other data structures that may contain elements that contain no specific values.
- Anonymous Methods - It is now possible to pass a block of code as a parameter. Anywhere a delegate is expected, a code block can be used instead: there is no need to define a new method.
- Namespace alias qualifier - The namespace alias qualifier (::) provides more control over accessing namespace members. The global :: alias allows access the root namespace that may be hidden by an entity in your code.
- Static Classes - Static classes are a safe and convenient way of declaring a class containing static methods that cannot be instantiated. In C# version 1.2 you would have defined the class constructor as private to prevent the class being instantiated.
- External Assembly Alias - Reference different versions of the same component contained in the same assembly with this expanded use of the extern keyword.
- Property Accessor Accessibility - It is now possible to define different levels of accessibility for the get and set accessors on properties.
- Covariance and Contravariance in Delegates -The method passed to a delegate may now have greater flexibility in its return type and parameters.
Describe new features introduced with C# 2.0 ?
New features C# 2.0 are:
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Below is indexer declaration : modifier return type this [argument list] { get { // Get codes goes here } set { // Set codes goes h...
-
1. An indexer is identified by it's signature. But a property is identified it's name. 2. An indexer is always an instance member,...
-
You can add public events for Httpmodule using below syntax i.e ModuleName_OnEventName in Global.asax . Example Session_OnStart ( Obj...
-
The steps to create custom HTTP module are : Implement IHttpModule Interface Handle Init Method and register events one needs Handle t...
-
Use a delegate when: An eventing design pattern is used. • It is desirable to encapsulate a static method. The caller has no need access o...
-
Please do below steps to make SQLServer session mode to work properly : 1. To use SQLServer mode, you must first be sure the ASP.NET sessi...
-
Different access modifiers/specifiers in C# : Public - Any class or assembly can access Protected - Access is limited to the containing ...
-
Replication is the way to keep data synchronised in multiple datbases. SQL Replication consists of two important part : Publisher - Datab...
-
OOPs concepts that C# supports are : Abstraction : is a process that involves identifying the crucial behavior of an object and eliminatin...
-
public class Operation { public int Add ( int a , int b ) { return (a+b); } } We have to call above method using delegate Steps below : D...
No comments:
Post a Comment