Testing the type of a generic in delphi
问题 I want some way to write a function in delphi like the following procedure Foo<T>; begin if T = String then begin //Do something end; if T = Double then begin //Do something else end; end; ie: I want to be able to do different things based on a generic type I've tried using TypeInfo in System but this seems to be suited to objects rather than generic types. I'm not even sure this is possible in pascal 回答1: TypeInfo should work: type TTest = class class procedure Foo<T>; end; class procedure