Solved

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

Posted on 2013-11-12
1
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

728 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