locked
Use XmlElementAttribute or XmlAttributeAttribute to specify a new name RRS feed

  • Question

  • I have base class which has a field named ID of type Int32. The base class i sbeen derived and i hide the ID field using new keyword and set the type of field as string, now when i use this derived class in web service i get the error "Use XmlElementAttribute or XmlAttributeAttribute to specify a new name"


    Raamakarthikeyan

    Tuesday, October 30, 2012 9:23 AM

All replies

  • [XmlElement(DataType = "string",ElementName = "NewName")]
            public string ID { get; set; }

    Try something like the above code. Make sure you have:

    using System.Xml.Serialization;

    Saturday, November 3, 2012 11:50 PM
  • I have tried the same, but still it gives me the same runtime error

    Raamakarthikeyan

    Monday, November 5, 2012 7:32 AM