C#: Customize XmlAttributeAttribute?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sipe
    New Member
    • Sep 2007
    • 1

    #1

    C#: Customize XmlAttributeAttribute?

    Hi!
    Because of legacy issues, I have to generate to generate a specific
    XML format.
    In c#, I would like for example some DateTime attributes to be
    included in the generated XML only if their value is different to
    DateTime.MinVal ue.
    For example if BeginDate=DateT ime.MinValue I want to generate
    <Node Id="8acc937a-2160-4d34-96df-879b1da1c886" />
    instead of
    <Node BeginDate="0001-01-01T00:00:00"
    Id="8acc937a-2160-4d34-96df-879b1da1c886" />
    But if BeginDate is set to another date I want it to be present in the
    generated XML.
    I want to make clear that It's not possible to change the type of
    BeginDate from DateTime to Nullable<DateTi me> for some reason.
    Is it possible to do this?
    Thanks
    John
Working...