Answers for "c# list get"

C#
6

c# list index

// Get the first item from the list

using System.Linq;

var myList = new List<string>{ "Yes", "No", "Maybe"};
var firstItem = myList.ElementAt(0);

// Do something with firstItem
Posted by: Guest on August-13-2020
3

find a value in list of objects in c#

var item = TextPool.FirstOrDefault(o => o.Name == "test");
if (item != null)
       item.value = "Value";
Posted by: Guest on April-03-2020
0

c# get all elements from list

You could get the Customers like this:

using System.Linq;

collectionCarts.SelectMany(c => c.OrderList.Select(o => o.Customer));
Posted by: Guest on March-16-2021

C# Answers by Framework

Browse Popular Code Answers by Language