Solved

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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