Solved

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

Posted on 2013-11-12
1
209 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 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