Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Generics Question
Message
De
13/07/2009 20:57:36
John Baird
Coatesville, Pennsylvanie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01412074
Message ID:
01412093
Vues:
54
>Then afterwards is says you can call the generic method with an explicit type declaration:
>
>
>PrintArray<int>(intArray);
>
>
>What is doesn't say it what you gain from this. Why would you call it this way?


Generics are used to provide a method which can process multiple types. By using your example above, you could call in with
PrintArray<int>(intArray)
or you could call it with :
PrintArray<string>(strArray) or PrintArray<double>(dblArray)
...etc.

The benefit is one method handles all.

Hope this helps..
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform