C# – Cannot convert null to type parameter ‘T’ because it could be a non-nullable value type

Problem You’re trying to return null from a generic method and you’re getting the following compiler error: Cannot convert null to type parameter ‘T’ because it could be a non-nullable value type. Consider using ‘default(T)’ instead You can’t return null because the compiler doesn’t know if T is nullable. Solution There are a few options … Read more C# – Cannot convert null to type parameter ‘T’ because it could be a non-nullable value type