I have created a generic response class and xmlroot element of that class will change based on Class type. What change I need to do in order for class to dynamically update value? Trimmed down version of code:
[XmlRoot($"ResponseOfType{typeof(T)}",
Namespace = "http://schemas.datacontract.org/2004/07/Dell.CDA.Entitlement.Contracts.Models")]
public class Response<T>
{
public Response()
{
}
[XmlElement("result1", Order = 0)]
public int? result1{ get; set; }
[XmlElement("result2", Order = 0)]
public int? result2{ get; set; }
}
ResponseOfType{typeof(T)}
-- this line is throwing error, I don't want to hardcode the value, and I am not using any serializer rather depending upon c# to produce XML to send response back as XML.