IEnumerable doesn't have a Count method

后端 未结 4 539
一整个雨季
一整个雨季 2020-11-27 19:06

I have the following method:

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

public IEnumerable GetRuleVio         


        
4条回答
  •  生来不讨喜
    2020-11-27 19:09

    Any() or Count() methods in Linq work only for generic types.

    IEnumerable
    

    If you have a simple IEnumerable without a type, try to use

    IEnumerable 
    
    
    

    instead.

    提交回复
    热议问题