Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP inlist() in c#
Message
De
26/01/2013 06:44:25
 
 
À
26/01/2013 05:37:50
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01320903
Message ID:
01564225
Vues:
38
>>>>>>>If I try
>>>>>>>
>>>>>>>Int16 closeDrawers = 2;
>>>>>>>
>>>>>>>if (closeDrawers.InList(2,4))
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>I get an error about Short don't have InList implemented. I bypassed it by using Int32 instead but just wondering what was wrong in the above.
>>>>>>
>>>>>>Remind us how you are currently implementing InList() ....
>>>>>
>>>>>
>>>>> public static bool InList<T>(this T s, params T[] list)
>>>>>        {
>>>>>            return list.Contains(s);
>>>>>        }
Don't see how that works. Arrays don't implement .Contains()......
>>>
>>>
>>>It was you that started with Contains, if memory serves
>>>
>>>But anyway http://msdn.microsoft.com/en-us/library/czz5hkty.aspx
>>>
>>>Arrays implement the IEnumerable interface. http://msdn.microsoft.com/en-us/library/vstudio/9eekhta0(v=vs.100).aspx
>>> IEnumerable contains Contains.
>>>
>>> Hence, ...
>>
>>:-{ - long day.
>>Of course, to be pedantic, I was correct - arrays do not natively implement .Contains() :-}
>
>
>You said: Don't see how that works. Arrays don't implement .Contains()......
>
>I only explained how it works - since you didn't see how it worked

I know. Just making my excuses... :-}
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform