Is my understanding of a generic method correct?
Posted on 2011-09-11
I'm trying to summarize for myself what a generic method is. Am I correct here?
Let's say you are implementing a method that accepts a collection of objects and sorts the objects. The method signature specifies the specific type of object you will be storing in the collection. Let's say the method takes "Collection<myType>" as its parameter. You can call this method with any collection whose element type in this collection is a parent of myType. This is an example of a generic method.