Similar features of LINQ
Is there any feature similar to LINQ (.NET) in different languages like JAVA, PHP, etc? ...
Is there any feature similar to LINQ (.NET) in different languages like JAVA, PHP, etc? ...
I have two IList<string> a and b. I want to find out what strings are in both a and b using LINQ. ...
HI , I am going to rewrite a store procedure in LINQ. What this sp is doing is joining 12 tables and get the data and insert it into another table. it has 7 left outer joins and 4 inner joins.And returns one row of data. Now question. 1)What is the best way to achieve this joins in linq. 2) do you think this affect performance (its o...
For a method I have the following parameter IEnumerable<string> tags and with to query a list of objects, let's call them Post, that contains a property IEnumerable<string> Tags { get; set; }. My question is: How do I use linq to query for objects that contains all the tags from the tags parameter? private List<Post> posts = new List<P...
Hi, I have a list like this: City Total Sydney 11 Dublin 9 London 12 Dublin 3 London 9 Sydney 12 I first of all need to Group By City & Sum Total so I have Sydney 23 Dublin 12 London 21 Next I need to filter for those that entries where the total is > 20 Sydney 23 London 21 And what I finally need is the total of these entrie...
I have a query which have multiple conditions on on clause SELECT * FROM CATALOGITEM with (nolock) INNER JOIN CATALOG with (nolock) ON CATALOGITEM.catalog_id = CATALOG.catalog_id and not(catalog.catalog_id = 21) AND NOT(catalog.catalog_id = 20) INNER JOIN PRODUCT with (nolock) ON CATALOGITEM.s_num = PRODUCT .s_num LEFT OUTER JOI...
Hi, I have about 100,000 lines of generic data. Columns/Properties of this data are user definable and are of the usual data types (string, int, double, date). There will be about 50 columns/properties. I have 2 needs: To be able to calculate new columns/properties using an expression e.g. Column3 = Column1 * Column2. Ultimately I woul...
if i have this code today to find out a sum total using LINQ: return (MyArray.Sum(r => r.Trips); and i want to only include itms where r.CanDrive == true. can you add a condition into a single linke lambda expression? how would you do this ...
Hi, I have a class as below: Class Financial { string Debit; string Credit; decimal Amount; } And I have a list with objects of this class, with multiple records. All I need is to perform a groupped sum, something like in sql Select debit, Credit, sum(amount) group by Debit, Credit I tried with a statement as below: f...
In a recent interview I was asked what the difference between .Any() and .Length > 0 was and why I would use either when testing to see if a collection had elements. This threw me a little as it seems a little obvious but feel I may be missing something. I suggested that you use .Length when you simply need to know that a collection ha...
Hi there, I'm loading from a xml some information about city's points of interest, and my xml structure looks like this: <InterestPoint> <id>2</id> <name>Residencia PAC</name> <images> <image>C:\Pictures\Alien Places in The World\20090625-alien11.jpg</image> <image>C:\Alien Places...
I can't figure out why I get a Object reference not set to an instance of an object. error if I use a ternary operator in my LINQ query. var courses = from d in somesource orderby d.SourceName, d.SourceType select new { ID = d.Int...
I have a dictionary collection as bleow: mydic.addvalue(key1, val1) mydic.addvalue(key2, val1) mydic.addvalue(key3, val1) mydic.addvalue(key4, val2) mydic.addvalue(key5, val2) From the above dictionary I want to delete all the entries where value == "val1", so that the result would have only following entry: mydic.addvalue(key4, val2...
I have two colluections List<Application> myApps; List<Application> yourApps; These lists have overlapping overlapping data but they are coming from different sources and each source has some missing field data. Application object has a property called Description Both collections have a unique field called Key i want to see if t...
How can I get a NullReferenceException in the following scenario? Dim langs As IEnumerable(Of SomeCustomObject) = //some LINQ query If langs Is Nothing Then Return Nothing If langs.Count = 1 Then //NullReferenceException here What am I missing here? Debug shows that langs is really just a LINQ queryresult without any results... ...
I would like to make a certain select item to lazy load latter in my linq query. Here is my query var posts = from p in context.post where p.post_isdeleted == false && p.post_parentid == null select new { p.post_date, p.post_id, p.post_titleslug, ...
Hi, I have a class Class MyObject { decimal v1; decimal dv1; decimal v2; decimal dv2; } and a List<MyObject> ... I need to process every element of the list by adding dv1 to v1 and dv2 to v2 Something like (pseudo-syntax): myList.Transform(o=>o.v1+=o.dv1, o.v2+=o.dv2) How can I do this (obvious my pseudo-syntax...
I have the following method, I wish to remove items from my collection that match the product Id. Seems fairly straight forward, but i get an exception. Basically my collection is getting out of sync. So what is the best way to remove an item from a collection. public void RemoveOrderItem(Model.Order currentOrder, int productId) { ...
I am just cuirous about behind of extension method mechanism.Some questions and answer appear in my mind. MyClass.OrderBy(x=>x.a).OrderBy(x=>x.b); I was guessing that mechanism was first orderby method works and order them by a member then returns sorted items in IEnumarable interface then next Orderby method of IEnumarable Order them...
Hi Folks, I have the following class defined in C# class myClass<T,U> { public T PropertyOne { get; set; } public U PropertyTwo { get; set; } } I need to write a function that reorder a list of myClass objects and takes two other parameters which define how I do this reorder: does my reordering depend on PropertyOne or Proper...