Category Archives: LINQ

PHPHOST BLOG

Web Hosting Related Articles You May Need

PLINQ: Set Degree of Parallelism using WithDegreeOfParallelism

Degree of parallelism is the maximum number of ‘concurrently’ executing tasks that will be used to process the query. A query could become a long running one if it is waiting for a resource to be released or hardware to respond. PLINQ can paralleli… Continue reading

Posted in LINQ, Syndicated | Comments Off on PLINQ: Set Degree of Parallelism using WithDegreeOfParallelism

PLINQ: Set Degree of Parallelism using WithDegreeOfParallelism

Degree of parallelism is the maximum number of ‘concurrently’ executing tasks that will be used to process the query. A query could become a long running one if it is waiting for a resource to be released or hardware to respond. PLINQ can parallelize this query by calling WithDegreeOfParallelism (which sets the maximum processor cores) after AsParallel().
AsParallel() method enables Continue reading

Posted in LINQ, Syndicated | Comments Off on PLINQ: Set Degree of Parallelism using WithDegreeOfParallelism

50 LINQ Examples Now in LINQPad

I had recently written an article on 50 LINQ Examples, Tips and How To’s.
Software Developer and geek John Flynn took these examples and did a great job compiling  these queries into a format which can be executed using LINQPad.
You can download the… Continue reading

Posted in LINQ, Syndicated | Comments Off on 50 LINQ Examples Now in LINQPad

50 LINQ Examples Now in LINQPad

I had recently written an article on 50 LINQ Examples, Tips and How To’s.
Software Developer and geek John Flynn took these examples and did a great job compiling  these queries into a format which can be executed using LINQPad.
You can download these examples over here.
LINQPad is a FREE tool that can execute any C#/VB/F# expression, statement block or program with rich output formatting. It’s Continue reading

Posted in LINQ, Syndicated | Comments Off on 50 LINQ Examples Now in LINQPad

LINQ: Generate Odd Numbers using Parallel Execution

A couple of months ago, I had written on Generate Odd Numbers within a Range using LINQ. In that post, I had demoed how to ‘sequentially’ generate odd numbers within a Range. However what if you have to generate a large set of numbers and are not interesting in generating the numbers in a sequence, you can use Parallel Execution. The ParallelEnumerable.Range() is just the right method for this Continue reading

Posted in LINQ, Syndicated | Comments Off on LINQ: Generate Odd Numbers using Parallel Execution

LINQ: Generate Odd Numbers using Parallel Execution

A couple of months ago, I had written on Generate Odd Numbers within a Range using LINQ. In that post, I had demoed how to ‘sequentially’ generate odd numbers within a Range. However what if you have to generate a large set of numbers and are not i… Continue reading

Posted in LINQ, Syndicated | Comments Off on LINQ: Generate Odd Numbers using Parallel Execution

LINQ: Compare two Sequences

How do you compare two sequences using LINQ? The answer is by using the Enumerable.SequenceEqual(). SequenceEqual() compares the source and target sequences elements, by using the default equality comparer for their type, and returns a Boolean.
Note: Check out my entire LINQ Snippets series here
There are many ways to use the SequenceEqual() extension method – like to compare the files in two Continue reading

Posted in LINQ, Syndicated | Comments Off on LINQ: Compare two Sequences

LINQ: Compare two Sequences

How do you compare two sequences using LINQ? The answer is by using the Enumerable.SequenceEqual(). SequenceEqual() compares the source and target sequences elements, by using the default equality comparer for their type, and returns a Boolean.
Note: C… Continue reading

Posted in LINQ, Syndicated | Comments Off on LINQ: Compare two Sequences

LINQ: Calculate Average File Size in C#

Let us see a simple code using LINQ and C# that calculates the average FileSize of the files kept in a folder.

First import the following namespaces:

using System.Linq;
using System.IO;

Then write the following code:

class Program
{
static v… Continue reading

Posted in C#, LINQ, Syndicated | Comments Off on LINQ: Calculate Average File Size in C#

LINQ: Calculate Average File Size in C#

Let us see a simple code using LINQ and C# that calculates the average FileSize of the files kept in a folder.

First import the following namespaces:

using System.Linq;
using System.IO;

Then write the following code:

class Program
{
static v… Continue reading

Posted in C#, LINQ, Syndicated | Comments Off on LINQ: Calculate Average File Size in C#