title: Why should I use Any method instead of Count?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/305092/which-method-performs-better-any-vs-count-0">Which method performs better: .Any() vs .Count() &gt; 0?</a>  </p>
  </blockquote>
  
  
  
  <p>I just wonder why should I use <code>Any()</code> instead of <code>Count()</code>?,  if we took the <a href="http://msdn.microsoft.com/en-us/library/bb343630.aspx" rel="nofollow noreferrer">msdn</a> example :</p>
  
  <pre><code>class Pet
  {
      public string Name { get; set; }
      public int Age { get; set; }
  }
  class Person
  {
      public string LastName { get; set; }
      public Pet[] Pets { get; set; }
  }
  
  public static void AnyEx2()
  {
      List&lt;Person&gt; people = new List&lt;Person&gt;
          { new Person { LastName = "Haas",
                         Pets = new Pet[] { new Pet { Name="Barley", Age=10 },
                                            new Pet { Name="Boots", Age=14 },
                                            new Pet { Name="Whiskers", Age=6 }}},
            new Person { LastName = "Fakhouri",
                         Pets = new Pet[] { new Pet { Name = "Snowball", Age = 1}}},
            new Person { LastName = "Antebi",
                         Pets = new Pet[] { }},
            new Person { LastName = "Philips",
                         Pets = new Pet[] { new Pet { Name = "Sweetie", Age = 2},
                                            new Pet { Name = "Rover", Age = 13}} }
          };
  
      // Determine which people have a non-empty Pet array.
      IEnumerable&lt;string&gt; names = from person in people
                              where person.Pets.AsQueryable().Any()
                              select person.LastName;
  
      foreach (string name in names)
          Console.WriteLine(name);
  
      /* This code produces the following output:
  
         Haas
         Fakhouri
         Philips
      */
  }
  </code></pre>
  
  <p>What if I used :</p>
  
  <pre><code>  IEnumerable&lt;string&gt; names = from person in people
                              where person.Pets.Count() &gt; 0
                              select person.LastName;
  </code></pre>
  
  <p>It will give same result ! , (I don't think it created for shortness or something) , is there any feature for <code>Any()</code> ??</p>