Les nouveautés de c# 4.0

3889 mots 16 pages
4.0
New features in C# 4.0

Mads Torgersen, C# Language PM

Contents
Introduction 1
Dynamic binding 3
Named and Optional Arguments 6
Features for COM interop 8
Variance 9
Relationship with Visual Basic 11
Resources 11

Introduction

The major theme for C# 4.0 is dynamic programming. Increasingly, objects are “dynamic” in the sense that their structure and behavior is not captured by a static type, or at least not one that the compiler knows about when compiling your program. Some examples include

• objects from dynamic programming languages, such as Python or Ruby

• COM objects accessed through IDispatch

• ordinary .NET types accessed through reflection

• objects with changing structure, such as HTML DOM script objects

• data readers and other user defined dynamic objects

While C# remains a statically typed language, we aim to vastly improve the interaction with such objects.

A secondary theme is co-evolution with Visual Basic. Going forward we will aim to maintain the individual character of each language, but at the same time important new features should be introduced in both languages at the same time. They should be differentiated more by style and feel than by feature set.

The new features in C# 4.0 fall into four groups:

Dynamic binding

Dynamic binding allows you to write method, operator and indexer calls, property and field accesses, and even object invocations which bypass the C# static type checking and instead gets resolved at runtime.

Named and optional arguments

Parameters in C# can now be specified as optional by providing a default value for them in a member declaration. When the member is invoked, optional arguments can be omitted. Furthermore, any argument can be passed by parameter name instead of position.

COM specific interop features

Dynamic binding as well as named and optional arguments help making programming against COM less painful than today. On top of that,

en relation

  • FI2 INFANG Cahier Des Charges
    2054 mots | 9 pages
  • Uc 4.5.6.7.8.9
    984 mots | 4 pages
  • Correction Tude De Cas Equidia BTS SIO SLAM 2013
    679 mots | 3 pages
  • Crack wii 4.3
    1965 mots | 8 pages
  • Nouveauté scolinfo
    526 mots | 3 pages
  • Nouvelle mise à jour
    492 mots | 2 pages
  • Publicité
    2594 mots | 11 pages
  • Le nouveau
    798 mots | 4 pages
  • Ue 4.1
    1367 mots | 6 pages
  • Marketing
    1335 mots | 6 pages
  • Ue 4.1
    454 mots | 2 pages
  • Les interets de la nouvelle
    379 mots | 2 pages
  • Dissertation
    3883 mots | 16 pages
  • Compta
    14906 mots | 60 pages
  • Ue 4.4 S4
    354 mots | 2 pages