Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What syntax is it?
Message
De
05/04/2009 09:34:55
 
 
À
05/04/2009 09:08:58
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01393308
Message ID:
01393322
Vues:
47
I believe named parameters are for version 4. In addition, the args are not between ( and ), so it cannot be a method/constructor call
( see http://blogs.windowsclient.net/alesrosina/archive/2008/12/02/new-stuff-in-c-4-0.aspx under optional parameters)

Looks like an object/collection initializer (http://msdn.microsoft.com/en-us/library/bb308966.aspx#csharp3.0overview_topic13 - see 26.4 Object and Collection Initializers)


I'd say it is the shorthand for
var xx = new ComparisonContract<Foo>() ;
xx.ImplementsOperatorOverloads = true ;
xx. EquivalenceClasses =  {
     { new Foo(1) },    // What is this?
      { new Foo(2) },
      { new Foo(3) }
   }
>Hi,
>But, what is ImplementsOperatorOverloads = true; ? Named parameter?
>
>
>new ComparisonContract<Foo>
>>>  { // What is this?
>>>    ImplementsOperatorOverloads = true; // Optional (default is true)
>>>    EquivalenceClasses =
>>>    {
>>>      { new Foo(1) },    // What is this?
>>>      { new Foo(2) },
>>>      { new Foo(3) }
>>>    }
>
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform