I have the following generic method, but VS gives me a compile error on that. (Operator \'??\' cannot be applied to operands of type \'T\' and \'T\')
public stat
model ?? new T() means model == null ? new T() : model. It is not guaranteed that model is non-nullable and == cannot be applied for null and a non-nullable object. Changing constraint to where T : class, new() should work.
model ?? new T()
model == null ? new T() : model
==
null
where T : class, new()