Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP inlist() in c#
Message
De
02/10/2008 06:13:55
 
 
À
02/10/2008 05:47:36
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01320903
Message ID:
01352199
Vues:
63
>>>Cool.
>>>I can't actually remember what we were trying to do but I like the way you did it !
>>>
>>>But I guess that since extension methods are, under the hood, built as regular methods then generics should work in the same way.
>>>
>>>Best,
>>>Viv.
>>__
>>
>>Yeah, it's a long time ago. When I read about them I felt so excited I had to post it ;-)
>
>Also worth remembering that you can apply extension methods to Interfaces as well.
>Regards,
>Viv
_________

Yes, - I saw an example of that - need time to digest that
(Accelerated C# 2008 - apress - pages 415 +)

I have not compiled this - just typed it

ps: LessThan, GreaterThan signs replaced by { and } - Michel is eating them
public static class MyExtensions
{
    public static IEnumerable {R} Transform{T, R}(this IEnumerable{T} input, Func{T, R} op)
    {
        foreach( var item in input)
        {
            yield return op (item) ;
        }
    }
}
cheers,
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform