Return to Snippet

Revision: 39444
at January 18, 2011 00:42 by jalalx


Initial Code
public static bool CanXmlDeserialize<T>(string filename)
        {
            bool result = false;
            try
            {
                XmlReader reader = XmlReader.Create(filename);
                XmlSerializer serializer = new XmlSerializer(typeof(T));
                result = serializer.CanDeserialize(reader);                
                reader.Close();
            }
            catch
            {
                result = false;
            }
            return result;
        }

Initial URL

                                

Initial Description
Checks for can XML Deserialize file.

Initial Title
CanXmlDeserialize

Initial Tags
xml

Initial Language
C#