Search
 Interview Question

Answer:

    

public static long display()
{
var tempval = (from h in objDB.tbl_mvc_login
select h).Count ();

return tempval;
}



    

public static long display()
{
var tempval = (from h in objDB.tbl_mvc_login
select h).LongCount ();

return tempval;
}


Look carefully to the above methods declared. They both does the same thing but LongCount() has a greater range than Count(). According to MSDN, it has the range from

long.MinValue = -9223372036854775808

long.MaxValue = 9223372036854775807


which is quite big. Its DotNet Framework type is System.Int64. While count() DotNet Framework type is System.Int32 which has a range from

long.MinValue = -2,147,483,648

long.MaxValue = 2,147,483,647


So, next time if you want to count something which is quite big then use LongCount() extension method otherwise use Count().


Thanks and Regards
Akiii


Source: MSDN | | Alert Moderator 

Share this to:

Bookmark It

Comments or Responses

Login to post response

Submit & Win
Submit and win
Prizes !
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Articles Author
Thu, 18-Dec-2014 Authors
All Time Authors
Vishal@Neeraj
43920
Rajkatie
20680
Bharathi Cherukuri
18040

Latest members | More ...


(Statistics delayed by 5 minutes)