- Using instance
if (new T() is ISoftDelete)
- Using type(IsAssignableFrom)
if (typeof(ISoftDelete).IsAssignableFrom(typeof(T)))
Is there any difference between these two line regarding efficiency, and which one would be better to use. T is Entity, and it has default parameterless constructor, so there is nothing in constructor. I know option 1. creates new instance, and options 2. looks like it is using reflection.
PS This is not the same as linked question because there 'obj' was existing object and here I have only generic class T, not instance so the answer might not be the same. Here options are calling empty constructor vs calling typeof() 2 times?