C# Xmlserializer There Was An Error Reflecting Property
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of there was an error reflecting type list this site About Us Learn more about Stack Overflow the company Business
There Was An Error Reflecting Field
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask there was an error reflecting type while serializing Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign c# xmlserializer ignore property up There was an error reflecting property 'Lists' up vote 0 down vote favorite I am trying to serialize a custom object into xml with this code: MatchList matchList = converter.Convert(excelStream); XmlSerializer xmlSerializer = new XmlSerializer(typeof(MatchList)); StringWriter stringWriter = new StringWriter(); xmlSerializer.Serialize(stringWriter, matchList); string serializedXml = stringWriter.ToString(); txtResult.Text = serializedXml; However I get the exception above in the 2nd line: The matchlist object
There Was An Error Reflecting Type System Collections Generic List
is defined as: public class MatchList { public Header Header { get; set; } [XmlArray("Lists")] [XmlArrayItem("List")] public virtual List Lists { get; set; } } c# xml xml-serialization share|improve this question edited Nov 23 '12 at 17:40 Aubin 8,85212450 asked Nov 23 '12 at 14:55 Luis Valencia - MVP 5,7342599198 the internal
is a custom object, not c# List object. –Luis Valencia - MVP Nov 23 '12 at 14:57 what exception did you get? –Kirill Bestemyanov Nov 23 '12 at 14:57 Please show the code of List class. That said, to avoid confusion, why not using another name than List? –Steve B Nov 23 '12 at 14:59 By any chance, is your List non-public? If I recall correctly, XmlSerializer requires all objects be public. EDIT: Woah, didn't realize your type was List
... can't... but... ****explodes**** –Chris Sinclair Nov 23 '12 at 15:03 You need to post List in the T of List
here for a quick overview of the site Help there was an error reflecting property xml serialization c# Center Detailed answers to any questions you might have Meta xmlserializer there was an error reflecting type interface Discuss the workings and policies of this site About Us Learn more about Stack
There Was An Error Reflecting Type Wcf
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question http://stackoverflow.com/questions/13531470/there-was-an-error-reflecting-property-lists x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up XML Serialization Error - There was an error reflecting type up vote 1 down vote favorite http://stackoverflow.com/questions/19830373/xml-serialization-error-there-was-an-error-reflecting-type I am trying to serialize few custom settings from configuration file. Below are my settings:
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/Data Access/XML and XmlDataSource Control/XML deserialize error reflecting type XML deserialize error reflecting type RSS 2 replies Last post Sep 25, 2008 09:35 AM by devmetz ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Reply devmetz Member 31 Points 149 Posts XML deserialize error reflecting type Sep 20, 2008 11:17 PM|devmetz|LINK Hi everybody, I get the an error with message "There was an error reflecting type 'ExampleSiteMap' while trying to deserialize an XML file into an object: The following is the context. trying to deserialize XML: ExampleSiteMap s = new ExampleSiteMap(); XmlSerializer serializer = new XmlSerializer(typeof(ExampleSiteMap)); Classes: [Serializable()] public sealed class ExampleSiteMap { private SiteMapNode nodes; [XmlElement] public SiteMapNode Nodes { get { return nodes; } set { nodes = value; } } public ExampleSiteMap() { } } [Serializable()] public sealed class SiteMapNode:NameObjectCollectionBase { public SiteMapElements this[int index] { get { return (SiteMapElements)base.BaseGet(index); } set { base.BaseSet(index, value); } } public SiteMapNode() { } public void AddElement(SiteMapElements e) { base.BaseAdd(e.Text, e); } public SiteMapNode(SerializationInfo info, StreamingContext context) :base(info,context) { } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); } } [Serializable()] public sealed class SiteMapElements { private string link; private string text; [XmlElement] public string Link { get { return link; } set { link = value; } } [XmlElement] public string Text { get { return text; } set { text = value; } }