locked
The method count is not supported - ContactSet RRS feed

  • Question

  • Hello Everyone

    I have following code

          var contactSet = xmrSerivce.ContactSet
                                    .Where(c => c.FirstName == "xxxx");

         if(contactSet.Count>0)

    do something

    I get "The method count is not supported" error. How do I count the number of elements returned.

    Thanks

    Thursday, March 22, 2012 6:18 PM

Answers

  • You can either do:

    var contactSet = (xmrService.ContactSet

    .Wnere(c => c.FirstName == "xxx")).AsEnumerable();

    or

    if (Enumerable.Count(contactSet) > 0)

    • Marked as answer by WPF_Dev Thursday, March 22, 2012 8:18 PM
    Thursday, March 22, 2012 6:47 PM