Tag: List
Convert All Strings in a List to Upper Case using LINQ in C#
Below is a sample code snippet which demonstrates on how to convert all strings in a list to upper case using LINQ in C#.
?
How to Add item to the beginning of List in C# ?
If you want to add or insert an item to the beginning of the List in C# , you can use the Insert method defined in the collection as shown below. How to Add item to the beginning of List in C# ? using System; using System.Collections.Generic; using System.Linq; namespace ACCode { class Program { static void Main(string[] args) { …
How to List out only Even Numbers from a List of Integers using Lambda Expression in C#?
Below is sample code snippet that demonstrates how to list out only even numbers from a list of integers using Lambda Expression in C#. How to List out only Even Numbers from a List of Integers using Lambda Expression in C#?
How to List Odd Numbers from a List of Integers using Lambda Expression in C#?
Are you looking out for a simple logic to retrieve the odd numbers from the list of integers using Lambda Expression in C#? Below is a sample code snippet demonstrating how to do it. How to List Odd Numbers from a List of Integers using Lambda Expression in C#?
How to Remove Objects from the List with RemoveAll in C#?
Below is a sample code snippet demonstrating How to Remove Objects from the List with RemoveAll in C#? How to Remove Objects from the List with RemoveAll in C#?
How to select top 5 records from List using LINQ in C#?
Below is a sample code snippet demonstrating on how to select top 5 records from a list using LINQ in C# using the Take extension method… How to select top 5 records from List using LINQ in C#?
How to Get the Maximum value from a List of String using LINQ in C# ?
In one of the previous article , we explained how to get the maximum value from a list of integer using LINQ query in C# . What happens when the column is a string instead of integer ?. Below are 2 possibilities on how to get the maximum value from a list of string. How to Get the Maximum value from a List of String…
How to Convert a List to ObservableCollection in C#?
This simple blog post will explain how to convert a List of Object to ObservableCollection of Object in C# and Windows Phone 8. There are times when you want to convert a List of Object to ObservableCollection specially when binding an ObservableCollection to the LongListSelector etc. The reasons for this can be several. How to Convert a List to ObservableCollection in C#? To Convert a…
How to check if List is Empty using LINQ in C#?
Below is a sample source code demonstrating the usage Any () and Count () to check if the list is empty in LINQ. How to check if List is Empty using LINQ in C#?