Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Generics Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
C# Generics Question
Divers
Thread ID:
01412074
Message ID:
01412074
Vues:
104
I'm reading a C# book, and in the section on Generics it has this example:
class Program
{
    static void Main(string[] args)
    {
        int[] intArray = { 1, 2, 3, 4, 5, 6 };

        PrintArray(intArray);
    }

    static void PrintArray <E> (E[] inputArray)
    { 
        foreach(E element in inputArray)
        {
            Console.WriteLine(element + " ");
        }
        Console.WriteLine("\n");
    }
}
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?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform