Solved

Question on delegate Func<CustType, string, string, byte[]>

Posted on 2013-11-12
1
210 Views
Last Modified: 2014-02-20
The VS2012 (.NET 4.5) compiler complains the following code:

public Func<CustType, String, String, byte[]> TokenServiceImpl { get; set; }

SomeType GetToken(CustType c, String server, string app, out byte[] key)
{
    if (TokenServiceImpl == null) {throw new exception("xxxxx");
   
    // This is the line where it gets compiler error
    return  TokenServiceImpl (c, server, app, out key);
}

Error:  Delegate "Func" does not take 4 arguments.

I have spend quite some on it but still cannot figure it out.
Can someone offer any suggestion? Big thanks in advance.
0
Comment
Question by:chuang4630
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39642682
Two things:  1) The error is correct:  Your delegate does not take 4 parameters; it takes 3, with a return type of byte[]    2) The out that you see in Intellisense:

Screenshot
...has to do with the result being covariant, and not as a direct reference to the object in memory like you have with the out keyword. In other words, you don't need out in that statement.

As to how to fix your error, you would need to describe more about what you are trying to accomplish.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question