Generics Serialization Exception

A

ashraftm

Hi,

I am getting following error while XMLSerialization a class with
nullable generic member.

Public Class Car {
[XmlAttribute]
public Nullable<decimal> Meter;
}

Car car = new Car();
car.Meter = null;
XmlSerializer xml = new XmlSerializer(typeof(Car)); // Error
here.........
xml.Serialize(writer, car);

If I remove [XmlAttribute] then no problem it works. otherwise folowing
exception occurs "InvalidOperationException was unhandled".

thank you.
Achu.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top