Reference Type Constraint: A reference type constraint restricts a type parameter to a reference type.
using System; using System.Collections; public class Starter { public static void Main() { // MyClass<int> obj1=new MyClass<int>(); [illegal] MyClass<XClass> obj2 = new MyClass<XClass>(); } } public class MyClass<T> where T : class { public void Iterate(T data) { } } public class XClass { }