Generics Serialization Exception

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.

.



Relevant Pages

  • another prob
    ... thanks a lot those who helped with the switch statements. ... The 7th step states (in the constructor of the car class pass the car model ... I would be very grateful if you could please help me. ...
    (comp.lang.java.help)
  • enum or FK question ?
    ... long carId; ... short carType; ... This class is mapped to table Car. ...
    (comp.lang.java.programmer)
  • Re: Private Constructor
    ... > public static string Name ... > I intended to create an enumeration class similar to Color ... Car car = car.NISSAN; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Another simple problem
    ... > What if you wanted a method called newunder Foobar obj? ... > But then the Car() method call doesn't make sense. ... All I was proposing was changing the syntax of the constructor ...
    (comp.lang.java.programmer)
  • Re: Packing for traveling: Anything Im missing for my Diabetes?
    ... My present plan is to have my main meter in my pocket or hand luggage, ... with one backup in a suitcase, and one in my car. ...
    (alt.support.diabetes)