Generics where T is class implementing interface
问题 I have a interface: interface IProfile { ... } ...and a class: [Serializable] class Profile : IProfile { private Profile() { ... } //private to ensure only xmlserializer creates instances } ...and a manager with method: class ProfileManager { public T Load<T>(string profileName) where T : class, IProfile { using(var stream = new .......) { var ser = new XmlSerializer(typeof(T)); return (T)ser.Deserialize(stream); } } } I expect the method to be used like this: var profile = myManager.Load