<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 24.09.2013 11:25, schrieb Sven
      Barth:<br>
    </div>
    <blockquote cite="mid:52415A70.9010108@googlemail.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Am 24.09.2013 11:19, schrieb
        Xiangrong Fang:<br>
      </div>
      <blockquote
cite="mid:CAP93jB0auoo_Q=o5b2_Z3-CM76wtxP=_+hVwJSU2S_cdro-Xkg@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div>
            <div>
              <div>Hi All,<br>
                <br>
                say, I have a class TTree<T>; in the destructor of
                that class, is it possible to know the actual type of T?
                I want to do things like:<br>
                <span style="font-family:courier new,monospace"><br>
                </span></div>
              <span style="font-family:courier new,monospace">generic
                TTree<T> = class<br>
              </span></div>
            <div><span style="font-family:courier new,monospace">public<br>
              </span></div>
            <div><span style="font-family:courier new,monospace">  Data:
                T;<br>
              </span></div>
            <div><span style="font-family:courier new,monospace"> 
                destructor Destroy; override;<br>
              </span></div>
            <span style="font-family:courier new,monospace">end;<br>
              <br>
            </span></div>
          <div><span style="font-family:courier new,monospace">destructor

              TTree.Destroy;<br>
            </span></div>
          <div><span style="font-family:courier new,monospace">begin<br>
                ... ...<br>
            </span></div>
          <div><span style="font-family:courier new,monospace">  if Data
              is TObject then Data.Free;<br>
            </span></div>
          <div><span style="font-family:courier new,monospace">end;<br>
            </span></div>
          <div><br>
          </div>
          <div>But "is" does not work with generic types.<br>
            <br>
          </div>
        </div>
      </blockquote>
      Short answer: No<br>
      Long answer: You could try to use TypeInfo(Data) or TypeInfo(T)
      and use the returned PTypeInfo to find out the type...<br>
    </blockquote>
    But it's not a good idea as you'd still need to convert Data to a
    TObject (e.g. by using a cast), but that will fail if Data is
    something else than a pointer-like type...<br>
    <br>
    Regards,<br>
    Sven<br>
  </body>
</html>