Questions tagged [linq]
Language INtegrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.
                602 questions
            
            
            
                5
            
            votes
        
        
            
                2
            
            answers
        
        
            
                269
            
            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 ...
                
            
       
        
            
                -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 ...
                
            
       
        
            
                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 ...
                
            
       
        
            
                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 <...
                
            
       
        
            
                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 ...
                
            
       
        
            
                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 ...
                
            
       
        
            
                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" ...
                
            
       
        
            
                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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                132
            
            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 ...
                
            
       
        
            
                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
...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                396
            
            views
        
        
            
            
            
        Is there a way to use lambda function to get the list?
                    I have a data set.
...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                132
            
            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:
...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                133
            
            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 ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                566
            
            views
        
        
            
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                133
            
            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 ...
                
            
       
         
         
         
         
        