If you want to compare two or more piece of code in your application for time taken this is the way to do it.
Stopwatch s1 = new Stopwatch();
s1.Start();
IEnumerable<Users> User = get();
var p = User.Where(m => m.int_UserId > 560);
foreach (var UserList in p)
{
// Console.WriteLine(UserList.int_UserId);
}
s1.Stop();
Console.WriteLine(s1.ElapsedMilliseconds);
////////////////////////////Process 2////////////////////////
Stopwatch s2 = new Stopwatch();
s2.Start();
IQueryable<Users> Userf = geti();
var pe = Userf.Where(m => m.int_UserId > 560);
foreach (var UserList in pe)
{
// Console.WriteLine(UserList.int_UserId);
}
s2.Stop();
Console.WriteLine(s2.ElapsedMilliseconds);
Comments
Post a Comment