|
|
Browse by Tags
All Tags » LINQ and LINQ to XML
Showing page 1 of 2 (14 total posts)
-
Some time ago, I was talking to some members of a team that used LINQ and LINQ to XML in one particular area of their code. They said that the code written using a conventional approach to XML was in the order of 6000 lines of code. When re-written using LINQ and LINQ to XML, it was around 800 lines of code. It was faster to ...
-
This is a bit of a geeky post for the LINQ and LINQ to XML folks.
This post introduces a GroupAdjacent generic extension method that groups elements in a collection with adjacent elements based on a common key. For example, grouping the following array creates six groups (not 3, as with GroupBy):
int[] ia = new int[] { 1, 0, 0, ...
-
It can be problematic for us here at Microsoft to make specific performance claims of one technology to another, for example, comparing the performance of XmlDocument, say, to LINQ to XML. A good programmer can write code in any number of technologies...(read more)
-
I've received some comments indicating that XSLT is better for these types of transformations. FWIW, I absolutely agree about the usage scenarios for XSLT. In the LINQ to XML documentation, I have at least 4 or 5 examples that show how to use XSLT to transform an XML tree. XSLT transforms create a new tree, so XSLT does not aleviate the ...
-
Introduction
Annotations can be used to facilitate transforms of an XML tree.
Some XML documents are ''document centric with mixed content.'' With such documents, you don't necessarily know the shape of child nodes of an element. For instance, a node that contains text may look like this:
[xml]
<text>A phrase with ...
-
Quite some time ago, I wrote a blog post on how you can stream text files as input into LINQ queries by writing an extension method that yields lines using the yield return statement.
You then can write a LINQ query that processes the text file in a lazy deferred fashion. If you then use the T:System.Xml.Linq.XStreamingElement to stream ...
-
We often use the Visitor pattern to separate the structure of an object tree or collection from the operations performed on that tree or collection. There are lots of ways in LINQ where you can visit some function on a collection, but when implementing this pattern as a couple of extension methods in LINQ to XML, we can pass the element depth as ...
-
You can, of course, use C# anonymous types to create types that are more than simple tuples. For example, you can nest anonymous types to create an object graph:
var PurchaseOrder = new { PurchaseOrderNumber = ''99503'', OrderDate = DateTime.Parse(''1999-10-20''), Addresses = new [] ...
-
Following are a few additional notes regarding the Linq to Text Files example.
Taking Advantage of Multiple CPUs
If you have some type of computing where you need to process large text files, and the processing of the text files is processor intensive, the possibility exists in the future where you could factor your ...
-
Lazy evaluation is an important technique in functional programming. There is a entertaining article on functional programming here.
I was thinking about lazy evaluation the other day, and the issues of processing huge text files using streaming techniques, and I realized that LINQ could do really cool things if I implemented an ...
1
|
|
|