Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » LINQ and LINQ to XML   (RSS)

New Version of Functional Programming Tutorial

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

The GroupAdjacent Query Operator Extension Method

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

Performance of LINQ to XML

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
Posted by EricWhite | 1 Comments

Performance of LINQ to XML

Introduction This section provides information regarding LINQ to XML performance, specifically of functional construction and queries. In This Section Topic Description Performance of Chained Queries Provides some analysis regarding the performance of
Posted by EricWhite | 0 Comments

Statically Compiled Queries

Introduction One of the most important performance benefits that you will note when comparing LINQ to XML and XmlDocument is that queries in LINQ to XML are statically compiled, whereas XPath queries must be interpreted at runtime . You need not do anything
Posted by EricWhite | 0 Comments

Preatomization of XName Objects

Introduction One approach that you can take to gain some performance is to pre-atomize XName objects. This would yield performance benefits when creating a large XML tree where specific names are repeated . The approach is to declare and initialize XName
Posted by EricWhite | 0 Comments

Atomized XName and XNamespace Objects

Introduction XName and XNamespace objects are atomized . This yields performance benefits for queries: comparing two atomized names for equality means that the underlying intermediate language (IL) only needs to determine if the two references point to
Posted by EricWhite | 2 Comments

Performance of Chained Queries

Introduction One of the most important aspects of LINQ (and LINQ to XML) is that performance of chained queries can be effectively the same as if you write one larger, more complicated query . Overview You can write a query that uses another query as
Posted by EricWhite | 0 Comments

More thoughts on LINQ to XML transformations that use annotations

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
Posted by EricWhite | 2 Comments

How to: Use Annotations to Transform LINQ to XML Trees in an XSLT Style

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
Posted by EricWhite | 2 Comments

Streaming From Text Files to XML

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
Posted by EricWhite | 2 Comments

Generating an XPath expression to find a LINQ to XML Node

In a number of places in the docs, I present code that finds nodes in the XML tree. Sometimes there are easy ways to describe the results of a query, but sometimes I wanted to describe the results of a query by specifically identifying exactly which nodes

LINQ to XML: Implementing the Visitor Pattern using Extension Methods

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
Posted by EricWhite | 1 Comments

Fun with Anonymous Types and LINQ to XML

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"),
Posted by EricWhite | 1 Comments

More Notes on LINQ to Text Files

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,
Posted by EricWhite | 1 Comments
More Posts Next page »
 
Page view tracker