SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 223 | Next

Scott Klein

"Professional LINQ"


XElement employees = XElement.Load(@"C:\Wrox\Employees.xml");
Another overload of the Load method takes an additional Boolean parameter that specifies whether to
preserve whitespace.
employees = XElement.Load(@"C:\Wrox\Employees.xml", true);
This next example illustrates how to load XML from a TextReader. Any kind of TextReader can be used;
in this case, it??™s a StringReader, but a StreamReader would work just the same.
130
Chapter 6: Programming with LINQ to XML
TextReader tr = new StringReader("ScottXElement xtree = XElement.Load(tr);
As before, another overload of the Load method takes an additional Boolean parameter that specifies
whether to preserve whitespace.
XElement xtree = XElement.Load(tr, true);
The following example creates an XML tree from an XmlReader. It first creates an XmlReaderSettings
instance and sets a few optional settings. Then it creates an XmlReader and uses the Create() method to
load an XML file into the XElement object.
XmlReaderSettings xmlset = new XmlReaderSettings();
xmlset.


Pages:
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6