Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Your profile
Tag cloud
.net asp.net asp.net mvc azure book bug business intelligence c# cloud computing database dates excel gemini google gotcha how to howto iis indexing interview jquery kanban linq measurement mvc nhibernate nunit performance process improvement programming rhino mocks security silverlight sql sql friday sql server sql server 2000 sql server 2005 sql server 2008 sql server 2008 r2 sqlserver structuremap t-sql tip trick unit testing vb.net vista visual studio 2010 windows 7
Authors
- SQLDenis (269)

- chrissie1 (200)

- onpnt (96)

- George Mastros (35)

- Alex Ullrich (24)

- tarwn (17)

- naomi (9)

- thatrickguy (8)

- damber (7)

- emtucifor (7)

- ca8msm (7)

- chopstik (6)

- More...
Main Categories
Search
Google Ads
Tags: linq
Last week I was asked to create a normalisation routine for the Msp spectra that my application uses. No worry if you don't know what Msp is. The thing is that it needed to find the maximum value in a collection of values and then do a calculation with that number over the other values in that collection.
First the value object.
In an ICollection(of T) you have a contains method to see if your collection has the requested element in it. But if you want to look for Multiple elements, you have to resort to making predicates (and we all know how ugly those get).
So why didn’t MS implement ContainsAny (OR) and/or ContainsAll (AND). I couldn’t think of a good reason, so I made them myself. They are perhaps a bit over easy and not very performance friendly but they work.
Here are the extension methods.
Problem
I keep forgetting that it needs the System.linq namespace to work. And I keep forgetting that it is not set by default on my projects. I try not to overuse linq but sometimes it is easy.
So what happened?
I was trying this:
Adam Machanic created an item on connect explaining how LINQ to SQL queries involving strings cause SQL Server procedure cache bloat
If an application is using LINQ to SQL and the queries involve the use of strings that can be highly variable in length, the SQL Server procedure cache will become bloated with one version of the query for every possible string length. For example, consider the following very simple queries created against the Person.AddressTypes table in the AdventureWorks2008 database:
Dinesh wrote a blogpost about .NET Framework 3.5 SP1: LINQ perf improvements (LINQ to Objects and LINQ to SQL). There are three perf improvements in the just released SP1
Specialized enumerable: The new implementation recognizes queries that apply Where and/or Select to arrays or List<T>s and fold pipelines of multiple enumerable objects into single specialized enumerables. This produces substantial improvement in base ove...
:: Next >>


LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.