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.

5 votes
2 answers
264 views

Sorting and filtering using dynamic parameters

I have this code which I am upgrading to .NET 8. The intention is to sort and filter the resultset using the parameters. Right now it has a lot of if else and redundant code inside the blocks. I would ...
codeandcloud's user avatar
-1 votes
1 answer
296 views

Optimizing LINQ Query on C# Web API

Can someone help me optimize this code especially the LINQ query. It takes 8-12 seconds just to return a response when I'm calling the endpoint. Its super slow, and my whole endpoint call is taking ...
Kraust123's user avatar
2 votes
1 answer
225 views

IEnumerable<T>.Tee implementation

I am trying to write A C# version of a method in the Java Stream API called Collectors.teeing() (It's like Aggregate but with multiple accumulator functions), just for educational purposes. I want to ...
Dennis_E's user avatar
  • 1,210
10 votes
3 answers
6k views

Filter out nulls from sequence of nullables to produce sequence of non-nullables

While introducing nullable reference types to our enterprise application's codebase, I found that we are often using LINQ on sequences of nullable reference types where we filter out the nulls using <...
Palec's user avatar
  • 201
1 vote
1 answer
1k views

Basic ATM Software from a Udemy Project

Recently starting to learn programming, I'm looking to move to making larger projects and am just picking up the basics now. I have a feeling this code sort of missed the point? Am looking for ...
Th3 M0rrig4n's user avatar
2 votes
2 answers
138 views

Project sequence to multiple sequences using LINQ (or extension methods)

I'm creating a method that expands a sequence. This is a sample of how it works: Input: {1, 2, 3} Output: {1}, {1, 2}, {1,2,3} So far, I've been able to solve the ...
SuperJMN's user avatar
  • 233
4 votes
1 answer
2k views

Transliterate between Cyrillic and Latin scripts

I want to get a code review on the following transliteration code. I wrote it because there were some libraries that I have tried and they were specifically failing with the name "Yuliya" ...
nop's user avatar
  • 819
1 vote
2 answers
621 views

Find the newest file that contains a specific string in every subdirectory of the path using the least resources

I have a server side logs folder that contains many hundreds of logs most of which are in subdirectories according to the machine the logs have come from. The task is to extract the full path of the ...
Richard Payne's user avatar
3 votes
1 answer
127 views

"Select followed by First" versus "First followed by Select" when summing the data for a student

I am wondering which one I should choose between the following two options when I need to calculate the sum of Data of the student with ...
Display Name's user avatar
0 votes
4 answers
2k views

Checking a value in a string array in C# [closed]

I want to see if there is a cleaner way to do this logic. I have a working sample: Same fiddle.net ...
Jefferson's user avatar
  • 123
1 vote
2 answers
391 views

Is there a way to use lambda function to get the list?

I have a data set. ...
Hello's user avatar
  • 113
1 vote
2 answers
126 views

Is there a way to simplify getting the character that appears the most in a collection with Linq?

I have a collection of strings, all of which are three characters in length: ...
Taco's user avatar
  • 929
1 vote
2 answers
129 views

Efficiency of finding one database record using two ID's

I'm using C#, .NET Core and the entity framework and am currently working on optimizing various functions for better performance. One of the main functions is getting a calculation based on two ...
RDAxRoadkill's user avatar
1 vote
1 answer
566 views

Is there a nice way to add unique items from inner collections using LINQ method syntax

Code ...
kuch's user avatar
  • 165
1 vote
1 answer
132 views

Reading data from a CSV and pushing it to a Salesforce application

I'm trying to write code that reads data from a CSV and pushes it to a Salesforce application using the API. My code processes the data in a for loop, but it takes a long time (3 hours) to run the ...
Ahmed Mujtaba's user avatar

15 30 50 per page
1
2 3 4 5
41