Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
2 votes
1 answer
107 views

I have a list of records, by multiple UserID's. TableID UserID Status ------------------------ 1 3 3 2 4 3 3 3 4 4 4 3 5 5 4 6 ...
Sherry8212's user avatar
0 votes
2 answers
153 views

I have a folder containing huge numbers of files in many subfolders, and I want to select the files with a name that matches any of a specified list of patterns (regular expressions). My regular ...
Theodor Zoulias's user avatar
7 votes
1 answer
260 views

I'm experimenting with C# Expression Trees and trying to understand the difference between Expression.Return and Expression.Goto. I can’t create an example where Return and Goto behave differently ...
Neomaster's user avatar
5 votes
6 answers
194 views

I have a list of items that contains duplicates, and I want to keep the last item of each group of duplicates. The native DistinctBy LINQ operator keeps the first item from each group, so it doesn't ...
Theodor Zoulias's user avatar
0 votes
3 answers
115 views

Working in C# with a custom object that has multiple rows and columns. I need to remove duplicate records where some (but not all) of the column values match, including positive and negative values of ...
MF Luder's user avatar
  • 380
1 vote
1 answer
101 views

Microsoft have changed ExecuteUpdateAsync to accept non-expression setters parameter in NET 10. Now it works this way: await context.Blogs.ExecuteUpdateAsync(s => { s.SetProperty(b => b....
Stanislav Gordenko's user avatar
Advice
0 votes
5 replies
105 views

I have the following use case: the database contains a row with a nullable column, and I would like to request only that column value from the database for a single row. This can easily be done using ...
R. Hoek's user avatar
  • 1,135
-5 votes
2 answers
200 views

Is there a way I can get the last five years of an object? I been trying to use Max to get the maximum year and then use range to get all the objects within that range: using System; using System.Linq;...
Jefferson's user avatar
  • 121
1 vote
1 answer
108 views

I am trying to use the InsertFromQuery() to add data to a SQL table: await cx.Users .Where(x => x.Country == "Romania") .InsertFromQueryAsync("Mailbox", mb => ...
Ginto's user avatar
  • 41
-6 votes
1 answer
157 views

I'm trying to get a multi line graph with Google charts. I am having an issue with sorting the data properly. My data is as follows: public class TemperatureReading (extra only, more fields present) { ...
KRM240's user avatar
  • 1
1 vote
1 answer
88 views

I am reading the book C#12 In a Nutshell. The author says: Loading navigation properties When EF Core populates an entity, it does not (by default) populate its navigation properties: using var ...
FluidMechanics Potential Flows's user avatar
3 votes
1 answer
125 views

We have a data table that have some data in column A, column B, column C (id). Note that the list is near 250 items. Here's it's a small representation In c# it gives a list like this: List<Item>...
baronming's user avatar
  • 275
2 votes
1 answer
152 views

I am building an editor script for Unity to import a complicated blueprint JSON asset extracted from another game engine. Some of this data is stored in the keys, meaning I cannot follow a typical ...
RowanofRohan's user avatar
1 vote
1 answer
94 views

I’m using Task.WhenAll with LINQ to run multiple async operations. However, when an exception is thrown inside one of the tasks, the stack trace seems incomplete compared to when I await each task ...
Ahmed Ben Khelifa's user avatar
-5 votes
2 answers
143 views

Decided to take a test in C#, I have a class called Purchase which has three string properties namely CustomerName, Item and Amount. I created my own implementation of the Purchase class whose details ...
So Few Against So Many's user avatar
0 votes
2 answers
128 views

Let's say I have someList of things I want to split into two separate lists by some condition. I've thought of 3 options: // 1 - two Where's var trueGroup = someList.Where(x => x.SomeCondition); ...
C Howell's user avatar
-2 votes
1 answer
141 views

Goal: Get previous record to current list for calculation using LINQ Result: Date | EatenFoodInKg | CompareToFoodFromYesterday 2000-01-11 10 9 (10-1) 2000-01-10 ...
HelloWorld1's user avatar
  • 14.2k
3 votes
1 answer
164 views

I'm working with some benchmarks, and I noticed some odd behaviour with my methods vs. Linq's implementation. Testing on .NET 9, X64 RyuJIT. I'm determining the max value within a decimal array. In ...
Ber'Zophus's user avatar
  • 7,797
7 votes
2 answers
283 views

I'm used to have a method in my code base, that basically does something like: return source as IList<T> ?? source.ToArray(); where source is an IEnumerable<T>. I used this method to make ...
Christoph Meißner's user avatar
2 votes
1 answer
79 views

I'm creating a LINQ extension using LINQKIT, but I can't figure out why I get this error System.AggregateException: One or more errors occurred (no method 'InGroupsImpl on type 'SLT.Assets.Extensions....
SteinTech's user avatar
  • 4,144
-2 votes
1 answer
69 views

I have a db table column where some properties are stored as json. Here is an example : properties ---------- { "SortBy" : "ASC" } List<MyItem> items = await this.dbContext....
Kung Fu Ninja's user avatar
0 votes
3 answers
191 views

I have an extension that returns true or false if value is null (null == false), called HasValueLite(). When I use the method in a LINQ statement, I get: System.AggregateException: 'One or more errors ...
SteinTech's user avatar
  • 4,144
1 vote
3 answers
133 views

I have a list of object and one item can have multiple value inside. I want to search dynamically the "theme" field with multiple criteria. So, my list is : class book { public int ...
baronming's user avatar
  • 275
1 vote
2 answers
109 views

I have an Entity Framework Core statement where I need to create a union of multiple selects. The number of selects is variable. I would like to do something like this, but it is not working: public ...
Joel's user avatar
  • 141
0 votes
0 answers
57 views

I have this code now that splits by size: IEnumerable<string> chunked = Enumerable.Range(0, statusMessage.Length / CHUNK_SIZE) .Select(i => statusMessage.Substring(i * CHUNK_SIZE, ...
Chris Harrington's user avatar
1 vote
1 answer
109 views

I would like to manage the rules that are to be checked with NRules in a database and read them in dynamically. I therefore need the rule definition in JSON format. For testing purposes, I have used ...
user31074039's user avatar
1 vote
2 answers
98 views

I have a performance problem processing 100000 client records. When I use a Linq query of looping through the orders it takes about 9 minutes. When I comment out the Linq query or the loop, the ...
user3552264's user avatar
1 vote
1 answer
75 views

There are identical values ​​in the column Bookings.TimeslotId. We need to group them (OrderByDescending?) and to take the last value (LastOrDefaultAsync?). I think this is a subquery on one line of ...
Garp's user avatar
  • 267
3 votes
1 answer
95 views

I have a concept which I have trouble into converting it into code. The basic idea is as shown below image Display data with non-overlapping dates The picture might not say much. To describe the issue,...
TUS's user avatar
  • 33
0 votes
1 answer
62 views

I have the following XML; I read it as a collection of XElements: <rql:select rdf:parseType=""Resource"" xmlns:rdf=""http://www.w3.org/1999/02/22-rdf-syntax-ns#"&...
user30880528's user avatar
0 votes
2 answers
573 views

My app allows the user to choose what table and columns to filter on. It can be a different table and columns each time the user runs this routine. So standard LINQ will not work. I need to do this ...
G Bradley MacDonald's user avatar
0 votes
2 answers
73 views

How to use EF Core Fluent API to get inheritance properties? I have a base class and 2 inherited children classes: class BaseClass { public string Name { get; set; } } class Child1 : BaseClass { ...
Dongdong's user avatar
  • 2,538
1 vote
2 answers
112 views

I am new to LINQ query and trying figure out how to filter list of records based on the list of IDs found in the sub-query inside. Basically, I am looking for the option similar to SQL "IN" ...
Milacay's user avatar
  • 1,547
0 votes
1 answer
103 views

I need to get the id into the string with comma from the object. I used linq but the string is System.Linq.Enumerable+WhereSelectEnumerableIterator`2[item,System.Int32] There are my two objects: ...
CDVS's user avatar
  • 11
1 vote
1 answer
65 views

I need to check if an account with "productNumber" = 90 and "sequenceNumber" = 1 exists - but only if the "status" (on the level above) = ACTIVE. I have managed to get ...
Lars Moe's user avatar
0 votes
0 answers
108 views

I am trying to parse an ini file and grab specific key-value pairs,given a section name and key name. I use the following code, using Linq, and it works if I don't include the key name in its search ...
NoBullMan's user avatar
  • 2,252
1 vote
1 answer
133 views

I'm working on a project that uses the legacy .NET Framework 4.x. I'm using LINQ here, but it's not behaving as I expected, and I'm not sure what mistakes I've made. I have the following MySQL table: ...
Tommas Lees's user avatar
-1 votes
1 answer
128 views

I'm trying to edit a spreadsheet by diving into its underlying XML files after I read the XLSX file as a ZipArchive. It's for a work project where we're trying to get rid of Excel running in the ...
T.P.'s user avatar
  • 175
0 votes
1 answer
225 views

I have a filter string conformant to the OData $filter syntax and wish to parse it into a System.Linq.Expressions expression. Context: The web API of our cloud application offers querying endpoints ...
F-H's user avatar
  • 1,213
0 votes
2 answers
132 views

I have two lists of the same object type with the columns: CustomerID ProductID 33, 120A 33, 240B 33, 14CD 33, 984A 34, 120A 34, 240B 35, 14CD 35, 984A 39, 120A 39, 240B 39, 14CD 39, 984A How can I ...
Deleted_User's user avatar
-1 votes
1 answer
93 views

I'm working on a C# application where I need to manipulate a list of Employee objects using LINQ's method syntax. Specifically, I'm attempting to: Sort the list first by ProjectId in ascending order, ...
Torak's user avatar
  • 17
1 vote
1 answer
88 views

I have grouped orders from the orders table so an order can have one or more purchases of a product with in an order. The problem is that when I purchase a single product that order with one product ...
redoc01's user avatar
  • 2,527
2 votes
2 answers
73 views

I have a stored procedure returning results in a FlaggedCarDTO object: public class FlaggedCarDTO { public int CarId { get; set; } public int FlagUserId { get; set; } public int Year { get;...
PixelPaul's user avatar
  • 2,833
1 vote
1 answer
71 views

A rather complicated object mapping I've inherited uses static Expression<Func<...>> in the .Select call (from my research these seem to be called "Expression Trees", but for ...
C Howell's user avatar
1 vote
2 answers
122 views

I am working on a legacy codebase where there are tons of repository methods that seem to be thread-blocking. I know calling ToList(), FirstOrDefault() over an IQueryable causes a synchronised fetch ...
Elham Kohestani's user avatar
0 votes
0 answers
86 views

I have the following: public Func<MyObj, bool> GetFilter(Status status) => status switch { Status.Active => x => x.Status == Status.Active && x.ValidFrom <= DateTime....
Ivan Debono's user avatar
  • 1,016
2 votes
1 answer
112 views

I am trying to implement a LINQ Expression Visitor ([ExpressionVisitor][1]) for the following scenario: remove all pagination-related calls, such as Skip, Take, OrderBy, and OrderByDescending. What I ...
Ricardo Peres's user avatar
0 votes
2 answers
80 views

So, I have some code here that's pretty straight forward in what I'm looking for. I'm trying to sum up a value from two (and possibly more) levels deep of objects. I can do it with the displayed ...
CrystalBlue's user avatar
  • 1,925
4 votes
2 answers
187 views

What is the time complexity of the following code in C#? array.Order().Take(k).ToArray(); Will LINQ treat this as QuickSelect? Or, will it perform full array sorting with the complexity O(n log n)?
Andrei's user avatar
  • 1,226
2 votes
1 answer
147 views

I am ordering a list of files by their name. My problem now is the order is different when running the same code in a Docker container (base image ubuntu/dotnet-aspnet:8.0-24.04_stable_130). My setup: ...
Franz's user avatar
  • 476

1
2 3 4 5
1736