Posted By


jalalx on 01/18/11

Tagged


Statistics


Viewed 483 times
Favorited by 0 user(s)

CanXmlDeserialize


/ Published in: C#
Save to your folder(s)

Checks for can XML Deserialize file.


Copy this code and paste it in your HTML
  1. public static bool CanXmlDeserialize<T>(string filename)
  2. {
  3. bool result = false;
  4. try
  5. {
  6. XmlReader reader = XmlReader.Create(filename);
  7. XmlSerializer serializer = new XmlSerializer(typeof(T));
  8. result = serializer.CanDeserialize(reader);
  9. reader.Close();
  10. }
  11. catch
  12. {
  13. result = false;
  14. }
  15. return result;
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.