linq select parent element from xml based on multiple child element
How to select a <client> element where <domain> contains any specified value : <config> <client> <name>Localhost</name> <domains>...
View ArticleFindAll Vs Where [duplicate]
This question already has an answer here: LINQ, Where() vs FindAll() 4 answers I have an IEnumerable<T> that I wanted to filter based on a LINQ predicate. I tried using Where on the IEnumerable...
View ArticleTrying to query many text files in the same folder with linq
I need to search a folder containing csv files. The records i’m interested in have 3 fields: Rec, Country and Year. My job is to search the files and see if any of the files has records for more then a...
View ArticleLINQ result to object initializer
I have a problem with converting linq result to object. I have a class called Plant and a database which contains information about it (for example name, latin name, habitats etc). i want to create a...
View ArticleConcatenate two string using LINQ
I want the output as the below string format using LINQ. [“providerZip”,”providerType”] Can anyone please tell me, how to concatenate the two string using LINQ? The post Concatenate two string using...
View ArticleLINQ sum of one column and insert to another table C#
i have two tables suck as the one below i wanna know how to sum “calorie” column based on name from table 1 and then insert the value to table 2...
View ArticleIs there a Match like syntax for LINQ
Here is a case I’m trying to solve elegantly. Let’s say I have an enumerable (and it might be a rather large enumerable that I’d prefer to enumerate only once). Let’s say also that I have specific...
View ArticleJoining clause in linq
I’ve created three table’s name: emps, emp_project, emp_location now i want to select one column from each table, but when im executing join query so far getting this this error: The type of one of the...
View ArticleRead all the values in a node in xml with key value pairand print them in...
I have an XML file with key/value pairs. XML file which I am using: <?xml version="1.0" encoding="UTF-8"?> <MAN_J6_Variant> <play_music_media_HK> <key name ="Media_Press"...
View ArticleCannot implicitly convert type System.Linq.IQueryable to System...
I have this linq query which will select all the records in my table InventoryLocation. however it gives me an error… I dunno what is the problem… I’m really new to this so bear with me… Error Cannot...
View Articlehow do I make this LINQ query faster?
modelData has 100,000 items in the list. I am doing 2 “Selects” within 2 loops. Could it be structured differently – as it take a long time – 10 mins public class ModelData { public string name; public...
View ArticleUsing lambdas LINQ query in C#
I am still in the midst of converting our web app from vb to C# and this complex query, that I just finished converting and have tested and it works properly, needs refactoring. This section could...
View ArticleMore graceful solution to nested Linq queries?
I have a set of nested linq queries that are used to get a property from a list of properties. It works great as-is, but it has one caveat. I have to put in error handling just in-case there isn’t a...
View Articlelinq query on list id’s
I have a list of id’s and I need to get all records correscponding to each id in the list . below is the sample code public List<Items> LoadLineItemByPkeys(IEnumerable<long> ItemId) { var...
View Article
More Pages to Explore .....