Skip to main content

All Questions

Tagged with
-1 votes
0 answers
26 views

Improving performance of contains method in ASP.NET MVC web application with large dataset

I have an ASP.NET MVC web application using C#, Visual Studio, and SQL Server. This is my code: if (!string.IsNullOrEmpty(Name)) { query = query.Where(x => x.PatientName.Contains(Name)); } The ...
hud. 's user avatar
  • 168
-1 votes
0 answers
63 views

Performance degradation of linq query in C# after .NET Core upgrade to 8 [duplicate]

I have the simple linq query in my .NET Core C# app. We have upgraded from .NET Core 3.1 to .NET 8. My query is as follows: Decimal[] cks = mem.Select(a => Convert.ToDecimal(a.KEKE_CK)).ToArray(); ...
anvesh's user avatar
  • 77
0 votes
0 answers
93 views

Why this C# code runs slow if the loop is more than 30 times? [closed]

int range = 20; var test = Enumerable.Range(0, range).Select(i => new Section { Id = i, Value = i }).ToList(); var result = RemoveEvenNum(test); foreach (var section in result) { Console....
Hui Jin's user avatar
  • 19
0 votes
1 answer
50 views

How to test a method that calls a persistence method returning IQueryable

I read in a few places that it's a good practice for a method that calls the database to return IQueryable because it allows extending queries in services using methods like Select, Where, etc., and ...
capslo's user avatar
  • 45
2 votes
2 answers
113 views

element-wise add / subtract / multiply / divide operation in two lists in C#

Considering element-wise add / subtract / multiply / divide operation in two lists. I have the code as follows. public class Calculate { public static IEnumerable<T> Add<T>(IEnumerable&...
JimmyHu's user avatar
  • 489
0 votes
1 answer
47 views

Improve performance of Moving Average calculation. IEnumerable vs List, foreach vs for, ElementAt,

I created a class to calculate a Exponential Moving Average: public class ExponentialMovingAverage { public Int32 Period { get; set; } public ExponentialMovingAverage(Int32 period = 20) { ...
Miguel Moura's user avatar
  • 38.6k
0 votes
1 answer
178 views

Strange performance issue with Where and Endswith, 7 times slower with .NET 8 than with .NET Framework

I discovered a strange performance issue with the following statement, after upgrading the solution from .NET Framework to .NET 8, I've got performance degradation about 7 times slower. I'm iterating ...
Markus Wolters's user avatar
0 votes
0 answers
37 views

Join LinqKit.PredicateBuilder across different Tables C#

I am trying to use LinqKit.PredicateBuilder to return if I should display a certain food drink item. My setup is, I have a FoodDrinkType table, FoodDrinkLink table, Enquiry table, EnquiryVenue table. ...
Smac 's user avatar
  • 401
1 vote
2 answers
53 views

Linq code improvement issues with filters

I have this linq query: private async Task<IQueryable<MyModel>> GetClaimList(MyDto input) { var claimQry = await _claimRepository.WithDetailsAsync(); var claimBatchQry = await ...
Jesus's user avatar
  • 445
0 votes
0 answers
77 views

Improve C# LINQ query to get the most suitable range among items (based on a condition)

I've got a List with 5 SubItems each. List consist of ~2 million of records. These records/items are already sorted/ordered for next queries. I've got two tasks: Find the best continuous range of ...
niknejm's user avatar
  • 21
0 votes
1 answer
86 views

Linq Query Performance issue on large number of records using C#

I'm having web application which is built into angularJs, C#, Linq etc. I'm having almost 2,00,000 lac records on production environment. Almost each columns have filters (Asc/Desc on click of column),...
Nimesh khatri's user avatar
0 votes
1 answer
56 views

Cannot perform SelectMany - Unable to materialize collection

query : var nodes = (from n in _db.TreeNodes.Where(n => passwordCycles.Select(c => c.HorusId).Contains(n.HorusId)) from path in _db.TreeNodes.Where(p => (EF.Functions....
guiz's user avatar
  • 155
0 votes
0 answers
81 views

Analysis of Null Handling for Max LINQ

I did an analysis of some of the most common recommended methods using BenchmarkDotNet This include DefaultIfEmpty OrderByDescending And Null Check with Any Clause (DetectIfEmpty) Through ...
Shay Maor's user avatar
0 votes
1 answer
110 views

Speedup query execution time for this linq query

I have this query that does the following : Pull childrens from the database Filter this childrens to get the ones that cannot be join to the availableItems query (that are not in the availableItems ...
guiz's user avatar
  • 155
0 votes
1 answer
43 views

How can I improve this Entity Framework LINQ query

I have the following EF query that is taking about 20 seconds to return ~100k rows. If I remove the "Addresses" and "Contacts" subqueries (if that's what you call them) in the ...
Gr3gg's user avatar
  • 55

15 30 50 per page
1
2 3 4 5
84