Skip to main content

Questions tagged [linq]

Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. Please consider using more detailed tags when appropriate, for example [linq-to-sql], [linq-to-entities] / [entity-framework], or [plinq]

linq
0 votes
1 answer
51 views

LINQ grouping by multiple properties and finding max and Min of another property

I have a model that is stored in a list: public class OrderDataModel { public string Product { get; set; } public string Registry { get; set; } public string ProjectID { get; set; } ...
Saif Ahsanullah's user avatar
0 votes
1 answer
35 views

How to group text to lines if there is small difference in Y position

Using PdfPig to read text from order PDF as described in Get Text Line By Line From PDF using C# answer static void GetWordsInReadingOrder(UglyToad.PdfPig.Content.Page page, StringBuilder builder) ...
Andrus's user avatar
  • 27.2k
-1 votes
1 answer
52 views

LINQ query where clause in list

I am trying to limit the data returned via a repository using the where clause based on a list of values. I have a PurchaseOrders entity where I want to return all purchase orders that have an ...
michael's user avatar
0 votes
3 answers
65 views

Selecting 2 Elements from XML

I am having a lot of trouble translating examples I am finding into use with XML. Starting with this (a very cut down version of the whole XML file) <?xml version="1.0" encoding="UTF-...
jc508's user avatar
  • 93
0 votes
2 answers
51 views

LINQ - Get key-value pairs for dictionary with lists

Let's say I have: Dictionary<string, List<string>> test = new() { { "animal", ["cat", "dog"] }, { "fruit", ["banana", "apple&...
AppleMoose's user avatar
0 votes
0 answers
68 views

Linq query DateOnly fields returning results on comparing dates

I have this linq query request as: var test = (... where ... && test.SL.Any(line => line.ServiceCode == serviceCode ...
Jesus's user avatar
  • 445
0 votes
2 answers
42 views

How to use Enumerable.Aggregate without getting CS0411 error

There are two DTO records: public record struct DateHour(int Hour, double? Value); private record struct HourSnapshot(uint TotalSeconds, double? Value); I have another method which works with enum. I ...
Anthony Voronkov's user avatar
3 votes
1 answer
67 views

Remove In Nested Loops (Remove Inside Foreach) [closed]

These are my entities: public class Permissions { public string PermissionName { get; set; } public List<Controllers> controllers { get; set; } } public class Controllers { public ...
Yasim Yasin's user avatar
0 votes
1 answer
48 views

System.Xml.XmlException: 'The ' ' character, hexadecimal value 0x20, cannot be included in a name.'

Wrote the code converter csv file to xml file and when i started it i have an error: internal class Program { private static void Main(string[] args) { var csvFile = @"sbor.csv&...
Shiryazdan Ushurbakiev's user avatar
0 votes
0 answers
28 views

Search implemented using LinqKit predicateBuilder working fine in the local but not working in the dev build

I have implemented a search functionality using the LinqKit predicate builder. It is working fine in the local environment and when it is published to a folder the same functionality is not working. ...
sid's user avatar
  • 1
0 votes
0 answers
50 views

Is there a way to convert a LINQ expression to another LINQ expression?

My repository class has a few methods for operations with the database. I recently developed the FindAsync() method, which allows you to grab only a few rows from the database based on an expression. ...
Sami Daniel's user avatar
1 vote
1 answer
82 views

EF Core : retrieve products with all supplier prices for price comparison and identify cheapest supplier

I'm working on an ASP.NET Core application using ABP framework and EF Core. I need to retrieve information about products and their suppliers for comparison purposes. Specifically, I want to achieve ...
aabdan's user avatar
  • 131
0 votes
1 answer
55 views

How to access a XML Parent Attribute with LINQ in C#

I cant seem to get the Linq syntax correct - or I dont know how to reference XML objects. I have XML like <?xml version="1.0" encoding="UTF-8"?> <Targets> <...
jc508's user avatar
  • 93
1 vote
2 answers
104 views

Multiple tables query with repository pattern

I have an ASP.NET Web API project, and have implemented repository and unitOfWork patterns. I currently have a big SQL query that I want to implement in code, it includes a lot of tables and joins. My ...
RifloSnake's user avatar
0 votes
0 answers
19 views

Coerce generic argument of expression

I have a situation where I need to logically-combine two expressions: Expression<Func<T1, bool>> expr1; Expression<Func<T2, bool>> expr2; In some cases, T1 and T2 are the same ...
caddzooks's user avatar

15 30 50 per page