Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

ienumerable doesnt have a count method

ienumerable doesnt have a count method  using -'c#,,enumerable'

I have the following method:

public bool IsValid
  get { return (GetRuleViolations().Count() == 0); }

public IEnumerable<RuleViolation> GetRuleViolations(){
  //code here

Why is it that when I do .Count() above it is underlined in red?

I got the following error:

  Error 1   'System.Collections.Generic.IEnumerable'
  does not contain a definition for
  'Count' and no extension method
  'Count' accepting a first argument of
  could be found (are you missing a
  using directive or an assembly
  reference?)   c:\users\a\documents\visual
  2010\Projects\NerdDinner\NerdDinner\Models\Dinner.cs  15  47  NerdDinner


asked Sep 22, 2015 by shegokar.anjeet
0 votes

Related Hot Questions

Government Jobs Opening