C#. What “The type T must be a reference type in order to use it as parameter.” means?
I'm trying to create a generic controller on my MVC C# Entity Framework Application. public class GenericRecordController<T> : Controller { private DbSet<T> Table; // ... public action(){ // ... db.Entry(T_Instance).State = System.Data.Entity.EntityState.Modified; } } However the DbSet< T > and T_Instance line has a compiler error. The type T must be a reference type in order to use it as parameter. When I constraint it for a class Controller where T : class it was solved. What does the error above means? I'm not asking for a solution. I would like to understand why this error occurs and why