Search code examples
c#visual-studio-2008delegatescompact-frameworkcompact-framework2.0

code doesn't compile at Compact Framework


The following code doesn't compile on Compact Framework 2 ( VS2008 )

public delegate TResult Func<out TResult>();
public delegate TResult Func<in T, out TResult>(T a);
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);

I'm not sure about what the code author meant to do, and I need to know how to workaroudn that.

Aditional Info: This code came from LinqBridge's source

Thanks


Solution

  • The code is just defining various Func delegates that weren't yet defined in .NET 2.0,

    Try taking out the in and out modifiers, since they aren't supported in .NET 2.0 either:

    public delegate TResult Func<TResult>();
    public delegate TResult Func<T, TResult>(T a);
    public delegate TResult Func<T1, T2, TResult>(T1 arg1, T2 arg2);
    public delegate TResult Func<T1, T2, T3, TResult>(T1 arg1, T2 arg2, T3 arg3);
    public delegate TResult Func<T1, T2, T3, T4, TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);