What does "where" mean in this generic singleton code?


What does “where” mean in generic singleton code?

It’s a generic type constraint.

Constraints inform the compiler about the capabilities a type argument must have. Without any constraints, the type argument could be any type. The compiler can only assume the members of System.Object, which is the ultimate base class for any .NET type. For more information, see Why use constraints. If client code uses a type that doesn’t satisfy a constraint, the compiler issues an error. Constraints are specified by using the where contextual keyword.