Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# Generics Question
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
C# Generics Question
Miscellaneous
Thread ID:
01412074
Message ID:
01412074
Views:
106
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
Next
Reply
Map
View

Click here to load this message in the networking platform