• tonur@feddit.dk
      link
      fedilink
      English
      arrow-up
      5
      ·
      7 months ago

      I have used typeof(T) inside the generic class, so fx a function inside the class Pie where T can be refered. But out of context, if you were to call typeof(T) inside Program.cs’s main function, it would not work.

    • Kogasa@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      7 months ago

      I don’t get what you mean. You can define class Pie and instantiate it with the type argument Pie.

      Huh, maybe I don’t get it because Lemmy is literally erasing angle brackets from our messages. Not just “not rendering.” It’s removing them entirely. There should be four angle brackets in the first line of this comment…