Hi,
This blog post summarizes the new features of C# 2.0.
Below are the new features been introduced.
§ Partial Classes
§ Static Classes
§ Generic Classes
§ Anonymous methods
§ Iterators
§ Nullable Types
Partial Classes | - Partial types allow classes, structs, and interfaces to be broken into multiple pieces stored in different source files for easier development and maintenance. |
Static Classes | |
Generic Classes | - Generics permit classes, structs, interfaces, delegates, and methods to be parameterized by the types of data they store and manipulate. - Provide stronger compile-time type checking. - Require fewer explicit conversions between data types - Reduces the need for boxing operations and runtime type checks |
Anonymous methods | - Anonymous methods allow code blocks to be written “in-line” where delegate values are expected. - Anonymous methods are similar to lambda functions in the Lisp programming language. - C# 2.0 supports the creation of “closures” where anonymous methods access surrounding local variables and parameters. |
Iterators | - Iterators are methods that incrementally compute and yield a sequence of values. - Iterators make it easy for a type to specify how the foreach statement will iterate over its elements. |
Nullable Types | - |
The language extensions in C# 2.0 were designed to ensure maximum compatibility with existing code. For example, even though C# 2.0 gives special meaning to the words where yield , and partial
in certain contexts, these words can still be used as identifiers.
Indeed, C# 2.0 adds no new keywords because such keywords could conflict with identifiers in existing code.
Hope this helps
Thanks & Regards,
Arun Manglick || Senior Tech
No comments:
Post a Comment