Using LinqBridge on the .Net2.0 Website

Could anyone use Linqbridge on a .Net 2.0 website? I have no problem using it in a regular .NET 2.0 console, but when I use methods on a website, I get

Feature 'extension method' cannot be used because it is not part of the ISO-2 C# language specification
+3
source share
2 answers

I think the error message is pretty clear. In version 2.0, extension methods are not supported. If you want to use the extension method in version 2.0, you need to change it by deleting thisand calling it explicitly.

If you have:

public static class ExtensionMethods {
    public static bool IsOdd(this int x) {
        return x % 2 != 0;
    }
}

Then the ExtensionMethodstype code number.IsOdd()will not compile.

You need to remove the thismethod in the signature IsOddand call it ExtensionMethods.IsOdd(number)to make it work under 2.0.

, , LinqBridge, .

, .

+2

, .NET #. LINQBridge .NET 2.0, LINQ # 3.0 (, VS2008 ). .NET 2.0. LINQBridge.

0

All Articles