Program to Find the Indexes in the List

Amatya
Posted by Amatya under C# category on | Points: 40 | Views : 377
Program to Find the Indexes in the List

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AmatyaListConcept
{
class Program
{
static void Main(string[] args)
{
//List<char> Lst1 = new List<char>();
List<string> LstAmatya = new List<string>();
LstAmatya.Add("Apple");
LstAmatya.Add("Mango");
LstAmatya.Add("Apple");
LstAmatya.Add("Banana");

var result = Enumerable.Range(0, LstAmatya.Count)
.Where(i => LstAmatya[i] == "Apple")
.ToList();

Console.ReadLine();

}
}
}


Output: In the result variable the value will be
0 2

Comments or Responses

Login to post response