Tech Off Post

Single Post Permalink

View Thread: Can't do Func ?
  • User profile image

    brian.shapiro said:
    evildictaitor said:

    The syntax shown in Visual Studio is Func<T, TResult> where T is a parameter.

    Either way, it won't let me pass in a type parameter by reference.

    You have the parameter order correct, but you still can't do what you want. The only thing a generic parameter can express is a type. The The parameter direction is defined by the Func<> delegate itself, and you can't change it. Depending on what you're trying to do, you can define your own delegate apart from Func<>. Something like this, perhaps:

    public delegate int MyDelegate(out char value);

    Actually, I'm not 100% sure the above is valid. An "out" parameter on a delegate may not be valid.