Hello Rnshanmugavadivel,
Seeing Your Code you are checking
if (newEventFile.RecordsCount!=0)
{
CollectionsOfEvtfiles.Add(newEventFile);
}
Simply you are adding only One Time..
Either
you run the loop
or ANotheir way Use
AdddRange Method.
which Adds the elements of the specified collection to the end of the List.
See The example & Try It
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<int> a = new List<int>();
a.Add(1);
a.Add(2);
a.Add(5);
a.Add(6);
int[] b = new int[3];
b[0] = 7;
b[1] = 6;
b[2] = 7;
a.AddRange(b);
foreach (int i in a)
{
Console.WriteLine(i);
}
}
}
Hope It Helps You.