XML : deserializing xml to different type

I'm trying to deserialize an XML (it's working so far). The XML reads in everything as strings.

When it goes to populate the property ID, I want to convert it to a GUID from the string. But I can't seem to get this work.

Thanks.

  public class Feature      {          [XmlAttribute]          public string ID          {          set              {                  ID = new Guid(ID);              }          }    

XML:

  <Features>              <Feature ID="8581a8a7-cf16-4770-ac54-260265ddb0b2" FeatureName="SharePoint Server Enterprise Site Collection features" />  </Features>    

No comments:

Post a Comment