Using Generics to Manipulate Enumerable Types


http://www.thedelphigeek.com/2013/03/using-generics-to-manipulate-enumerable.html

Comments

  1. Too bad that enumeration is not a limiter for generic classes.  That would have helped a lot for creating generics classes that would understand that functions such as Ord and GetEnumName were applicable to instances of type T.

    TEnum = class
      Value: T;
      Values: Set of T;
      function Low:T;
      function High:T;
      function Ord:Integer;
      procedure FromInteger(const Int: Integer);
      procedure FromString(const s: string);
      function ToString:String;
      function ToTypeString: String;
      ...
      as well as enumerators for the entire set, or the T enums found in Values, etc.

    ReplyDelete

Post a Comment