Use typeof in generic class
c#, generics
Solution
Answer is simple Generics need to be `Compile time` but what you're doing is obviously not known during `Compile time`
Problem
I Create Generic class like this: ``` public class Sample<T> where T : class { public DoSomething(); } ``` then I create new class : ``` public class Sample2 { Sample<Sample2> obj=new Sample<Sample2>(); } ``` why can't i use the below code to create an instance of `Sample` class in `Sample2` class? ``` Sample<typeof<this>> obj=new Sample<typeof<this>>(); ```