i want to have some class like this:
[XmlRoot(ElementName = typeof(T).Name + "List")]
public class EntityListBase<T> where T : EntityBase, new()
{
[XmlElement(typeof(T).Name)]
public List<T> Items { get; set; }
}
but typeof(T) cannot be attribute argument.
what can i do instead?
You could use
XmlAttributeOverrides– BUT – be careful to cache and re-use the serializer instance:(if you don’t cache and re-use the serializer instance, it will leak assemblies)