what to expect with c

Post on 12-Jul-2015

1.389 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Joseph Guadagno (jguadagno@sevdnug.org)FounderSoutheast Valley .NET User GroupTwitter: twitter.com/jguadagno

Dynamic lookupNamed and optional parametersCOM specific interop featuresVariancePotential features

The dynamic typeRuntime lookup

Dynamic objectsPlain objectsCOM objects

No syntax for class creation

Cannot find extension methods

Anonymous functions (ie Lamda expressions) cannot appear as arguments.

Named parametersOptional parametersOverload resolution

publ i c voi d Pr i nt Me( st r i ng t ext , i nt copi es, bool col l at e) ;

Pr i nt Me( t ext : “Hel l o Wor l d”, col l at e: t rue,

copi es: 1) ;

publ i c voi d Pr i nt Me( st r i ng t ext , i nt copi es = 1, bool col l at e = t rue) ;

Pr i nt Me(“Hel l o Wor l d”) ;

A signature is applicable if all its parameters are either optional or have exactly one corresponding argument (by name or position) in the call which is convertible to the parameter type.Betterness rules on conversions are only applied for arguments that are explicitly given – omitted optional arguments are ignored for betterness purposes.If two signatures are equally good, one that does not omit optional parameters is preferred.

Pr i nt Me(“Hel l o Wor l d”) ;

publ i c voi d Pr i nt Me(st r i ng t ext , i nt copi es = 1) ;publ i c voi d Pr i nt Me(st r i ng t ext ) ;publ i c voi d Pr i nt Me(obj ect t ext ) ;

Dynamic importCompiling without PIAsOmitting ref

Some COM interfaces are not yet availableIndexed propertiesDefault propertiesNOTE: these will only be used for dynamically typed objects. C# static objects will not support them.

Supported for interface and delegate types“Statically checked definition-site variance”Value types are always invariant

IEnumerable<int> is not IEnumerable<object>Similar to existing rules for arrays

ref and out parameters need invariant type

CompilerCompilerSource codeSource code

SourceFile

Source codeSource code

.NET Assembly

Class

Field

public Foo

private

string

X

Meta-programming Read-Eval-Print Loop

LanguageObject Model

DSL Embedding

Visual Studio 2010 and .NET 4.0 Traininghttp://cli.gs/VS2010training

The Future of C#, Anders Hejlsberghttp://cli.gs/FutureOfC

LINQ Farm: Covariance and Contravariance in C# 4.0

http://cli.gs/LinqFarm

Joseph Guadagno (jguadagno@sevdnug.org)FounderSoutheast Valley .NET User Group

top related