As we have seen, there is very little you can do in the methods of your generic class over the generic type value. You can pass it around (that is, assign it) and perform the limited operations allowed by the generic type functions I've just covered.
To be able to perform some actual operations of the generic type of class, you generally place a constraint on it. For example, if you limit the generic type to be a class, the compiler will let you call all of the TObject methods on it. You can also further constrain the class to be part of a given hierarchy or to implement a specific interface, making it possible to call the class or interface method on an instance of the generic type.
74 You cannot apply the TypeInfo call to a variable, like TypeInfo(s) in the code above, but only to a type.
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.