Is it possible to create a generic method of type T
where T
has a specific attribute?
E.g.:
public static XmlDocument SerializeObjectToXml<T>(T obj)
{
//...
}
and I want to serialize only a classes with a Serializable
and/or DataContract
attribute:
[Serializable]
[DataContract(Name = "viewModel", Namespace = "ns")]
internal class ViewModel
{
//...
}