Below are two queries that return the same data. Other then style I am not sure which is better.
What factors influence these queries?
What are the benefits of using one style over the other?
Sample 1
var x = from s in db.Surveys
join sq in db.Survey_Questions on s.ID equals sq.Survey_ID
join q in db.Questions on sq.Questio...
I am facing a scenario where I have to filter a single object based on many objects.
For sake of example, I have a Grocery object which comprises of both Fruit and Vegetable properties. Then I have the individual Fruit and Vegetable objects.
My objective is this:
var groceryList = from grocery in Grocery.ToList()
fr...
I'm adding a LINQ interface to some custom objects, but the C# compiler fails on type inference. However, I can write the equivalent query using the raw extension methods and type inference succeeds, so I'm not sure how the compiler is translating the query expression into extension method calls.
Is there a tool or compiler flag so I ca...
Greetings
I'm working on a project that requires me to write queries in text form, then convert them to some easily processed nodes to be processed by some abiguous repository. Of everything there, the part I'm least interested is the part that converts the text to nodes. I'm hoping it's already done somewhere.
Because I'm making stuff...
How to make this expression using the methods of exptension, but (!) not using anonymous types?
from p in posts
join u in context.oxite_Users on p.CreatorUserID equals u.UserID
join pa in context.oxite_PostAreaRelationships on p.PostID equals pa.PostID
join a in context.oxite_Areas on pa.Area...
The query
var q = from elem in collection
where someCondition(elem)
select elem;
translates to
var q = collection.Where(elem => someCondition(elem));
Is there a LINQ syntax that would translate to the following?
var q = collection.Where((elem, index) => someCondition(elem, index));
...