none
Type Parameter as Variable? RRS feed

  • Question

  • Hello,

    is it possible to pass a Variable to a Type Parameter instead to write the name of the class directly?
          Entry_Date.Entry_Date d = Entry_Create<Entry_Date.Entry_Date>();

    Something like this
          Type t = typeof(Entry_Date.Entry_Date);
          d = Entry_Create<t>();
    But there is a compilation error. Is there a way?

        // ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        internal T_Entry Entry_Create<T_Entry>() where T_Entry : new()
        // ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        {
          return new T_Entry();
        }
    Monday, April 8, 2019 4:06 PM

All replies