EnumerableExtensions.Any() overlaps with System.Linq.Enumerable.Any()

Topics: General
May 24, 2012 at 11:23 AM

New extension method EnumerableExtensions.Any() has the same signature as standard extension method System.Linq.Enumerable.Any(). It leads to the build error like this:

The call is ambiguous between the following methods or properties: 'NuGet.EnumerableExtensions.Any<string>(System.Collections.Generic.IEnumerable<string>)' and 'System.Linq.Enumerable.Any<string>(System.Collections.Generic.IEnumerable<string>)'

Steps to reproduce:

1. Add reference to NuGet.Core in your project

2. Try to compile this:

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using NuGet;

namespace TestProject1
    public class Class1Test
        public void TestTest()
            var items = new[] { "foo", "bar" };

            var result = items.Any();


May 24, 2012 at 3:17 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.