Answer the question
In order to leave comments, you need to log in
Typed sheet, search objects from first to last?
I don’t understand how to make it possible to get all objects in a row from a sheet of indefinite size and, in turn, display some values from each object to the console.
I thought it was worth creating a for loop, checking the size of the sheet and then getting objects by index, but FindIndex returns an int, and I need a reference to object to be returned so that I can get some values from this object later.
var _List = List<Class>();
for (int i = 0; i < _List.Count; i++)
{
var _firstList = _List.//какая-то функция//(i//номер записи//);
Console.WriteLine("" +_List.perem);
}
Answer the question
In order to leave comments, you need to log in
In short, I found the answer. This method simply eluded me, although I had re-read all the methods of the sheet 3 times before.
Who cares:
var _List = List<Class>();
_List.Sort();
var _checkObj = _List.ElementAt(_List.FindIndex(i));
Console.WriteLine("" +_checkObj.perem);
var myList = new List<string>(){ "item 1", "item 2", "item 3" };
// Обычный цикл по списку:
foreach (string str in myList)
{
Console.WriteLine("Item is: {0}", str);
}
// Лямбда:
myList.ForEach( (str) =>
{
Console.WriteLine("Item is: {0}", str);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question