score:2
Accepted answer
you are right in that amethod
will use linq to objects (no parallelism). you indeed need two specialized functions because l2o and plinq use different static query methods (enumerable
vs. parallelenumerable
). (or you make use of reflection which i think is too much here.)
you can make this work by calling the adapter method asparallel
in amethod
. asparallel
checks to see whether the argument is a parallel query and if yes it directly makes use of it.
Source: stackoverflow.com
Related Query
- ParallelQuery with methods that take in an IEnumerable
- Is there an IEnumerable implementation that only iterates over it's source (e.g. LINQ) once?
- linq deferred execution when using locks in methods that return IEnumerable
- EF Code First: Methods that can translate to SQL
- C# Code Contracts -- How to ensure that a collection of items contains items with unique properties?
- Verify that linq extension methods are called with moq
- Does a code that combines single() with yield make any sense?
- Aggregate methods to use with IEnumerable lists
- Is it possible to have a make a generic method which can take the place of three methods with a System.Data.Linq.Mapping.FunctionAttribute?
- Add a column to an IEnumerable in c# such that it works with WebGrid
- Calling a query from RIA Services with entities that have children created by other methods
- Union 2 lists with additional content change for ID that occurs in both source lists
- Writing code that can work with multiple database objects
- IEnumerable <T> with anonymous methods
- Get all entities from DbSet<TEntity> with a property value that is in an IEnumerable
- How can I take a list of dates, and remove any that are within 1 minute of another date in the list with LINQ?
- Implementation for a method that, with a given string, generates all its possible partitions that are a palindrome, using Linq methods
- How to avoid mapping errors with Linq Expressions in Methods that create compiler generated display classes?
- Code that Worked with MultiView fails with Wizard ASP.NET
- How can I take the information I received with linq and use that information in an if else statement?
- Multiple WHERE Clauses with LINQ extension methods
- Error: "The specified LINQ expression contains references to queries that are associated with different contexts"
- How are people unit testing code that uses Linq to SQL
- IEnumerable to string delimited with commas?
- What does this C# code with an "arrow" mean and how is it called?
- How to count the number of elements that match a condition with LINQ
- IEnumerable cannot be used with type arguments
- Nested "from" LINQ query expressed with extension methods
- IEnumerable Extension Methods on an Enum
- LINQ with Skip and Take
More Query from same tag
- To write a linq query to get selected name count
- Error calculating distinct values using LINQ in C#
- Unable to Select in LINQ to XML, error: Object reference not set to an instance of an object
- How to deal with datatypes returned by LINQ
- Exclude null values while summation by specific column in a left joined table using LINQ
- left join with up to one row in the right table in LINQ
- How to read an array of derived objects from DocumentDB with .NET client
- Using LINQ in an Update Method - trouble with where clause
- LINQ Set Operations not working (Intersect, Except)
- C# how to combine two queries and display data in datagridview
- Null Values in Entity Framework
- Linq where keyword vs. Where extension and Expression parameters
- Using the Select method for dynamic queries and expression trees
- How do you convert a List of object to a one dimensional array?
- LINQ contains in a list within a list
- Using LINQ's "into" keyword to group join not returning collection
- Compare two lists that contain a lot of objects (3th part) "those objects have different type"
- Dynamically filtering a column/property in to an EF 4.1 query using C#
- Linq : Combine a list with generic type using left join into a generic type
- Get max x rows plus all row info per group by in mysql to linq
- DataTable Data List with Related Column on Asp.Net
- Why would one define a local function in C# just to call it right away (in context of IEnumerable<T>)
- Storing a Dictionary<int,string> or KeyValuePair in a database
- show all linq sql queries per request
- How to use subItem level using Expression?
- T4 Template Linq not working
- need help translating CTE query into linq (not recursive)
- Using Linq, how to separate a list in to grouped objects by name?
- AD0.NET Entity Framework 4.0 or Linq-to-SQL
- How to bind a value to a variable in a programmatically generated Linq Expression