score:16
Accepted answer
Are you using .NET 3.5 by any chance? XDocument.Load(Stream)
apparently only arrived in .NET 4.
You might want to use the overload which takes an XmlReader
(which is supported in 3.5).
EDIT: Sample code:
static XDocument LoadFromStream(Stream stream)
{
using (XmlReader reader = XmlReader.Create(stream))
{
return XDocument.Load(reader);
}
}
score:3
The XDocument.Load(Stream)
method is new in .NET 4. For earlier versions of the framework, you need to read the stream first and pass it in as a string:
public static void readXMLOutput(Stream stream){
string streamContents;
using(var sr = new StreamReader(stream)){
streamContents = sr.ReadToEnd();
}
var document = XDocument.Parse(streamContents);
}
Source: stackoverflow.com
Related Query
- How to read XML file using System.IO.Stream with LINQ
- How to read xml file using linq
- How to read data from xml file using linq to xml?
- How to read Xml File Using LINQ in C#
- I need to save the XML file using linq with xml code in C#
- How to read data with pagination from large xml file using c#
- How to read multiple tags with same name under child node in a xml file using c#?
- How to read and modify an xml file using vb.net and linq
- How to load xml code block into existing xml file at a specific node using linq
- read xml file using linq
- How to read File names recursively from subfolder using LINQ
- How do I read/write an Encrypted XML file using LINQ to XML?
- How to read a string with UTF8 coding using linq to entities
- How to read XML file to a Dictionary<String,List<String>> with empty strings for null elements
- How to I read a json file containing array with C# and perform LINQ query on it?
- Read from xml file to objectlist using Linq
- How do I add a new element to the existing XML file on Windows Phone 7 using LINQ to XML?
- How to flatten a multi level XML into a single level XML using c# code LINQ
- How to parse a XML file using Linq - descendants
- Trying to read xml file with LINQ
- How to read XML using Linq
- How to read .csv file into array using LINQ
- Read last n elements of an XML file with Linq XDocument
- How to concatenate all child elements with same names values using LINQ to XML
- How to Parse an XML file with Linq Lambda from Given Key
- How do I read Child Nodes in Xml file using MVC
- Linq to XML C# Descendants: How to read Attributes with the same name?
- C# XML File: How to select a node with a certain value using LINQ
- How to query XML with the same element and attribute name using linq
- Read then write html to xml file using linq xml and xml writer
More Query from same tag
- How to join 2 complex linqs with override
- Pick line with the highest value of birth in every shop-country section
- C# Linq SQL select Multiple columns to List
- Write sql query to linq
- How to insert multiply items with entity framework and linq
- LINQ JSON add JProperty
- Entity Framework. Delete all rows in table
- Dynamic Expression using LINQ. How To Find the Kitchens?
- Error: FormatException was unhandled by user code in Linq how to solve?
- Call stored procedure in a Linq-to-Entities query
- .NET Dynamic LINQ OrderBy Joined and Nested Objects
- Linq operation with datatable
- How can i get primary of a new table generated from OrderBy / GroupBy?
- LINQ: Cannot insert duplicate key row in object 'dbo.tblOutstandingCompletions' with unique index
- LINQ: how to get an intersection of two sets of ints?
- LINQ filter collection by filed in it's subcollection
- How to join when using groupby
- replace smiley text with <img> tag
- how to group by over anonymous type with vb.net linq to object
- Loop a query match and remove subset items
- NHibernate LINQ Where and Any throwing exception
- select in select with Linq
- Is there a way to return a list of records which match an attribute of the first query filter result using LINQ?
- LINQ Include condition not applying
- LINQ: Select the Min and Max values from a collection on an entity after grouping
- Resharper reformatting Linq statement to put into and select on same line
- How to convert the below 2 foreach nested loops to linq query?
- MongoDB with C# - query with dynamically generated predicate
- LINQ IEnumerable<T[]> to IEnumerable<T>
- Map Expression<Func<Dto, bool>> to Expression<Func<Entity, bool>> using AutoMapper