c# - how to solve error "Exception has been thrown by the target of an invocation" -
when run below code, showing error
"exception has been thrown target of invocation"
what can solve issue?
public linqtoxml() { xdocument document = xdocument.load(@"d:\\data.xml"); #region fetch books var books = r in document.descendants("book") select new { author = r.element("author").value, title = r.element("title").value, genere = r.element("genre").value, price = r.element("price").value, publishdate = r.element("publish_date").value, description = r.element("description").value, }; foreach (var r in books) { com_xdocuments.items.add(r.publishdate + r.title + r.author); } #endregion }
shouldn't be
xdocument document = xdocument.load(@"d:\data.xml"); both same @"d:\data.xml" , "d:\\data.xml"
Comments
Post a Comment