none
Delegates RRS feed

  • Question

  • I have a question concerning Delegates. For example in the following code Delegateptr obj = new Delegateptr(Method). I was wondering can all functions or methods have a method as a parameter as in the preceding code, or is this only allowed when using a Delegate. Thanks !
    Tuesday, July 11, 2017 3:33 PM

Answers

  • You are right, you can only use Delegates when you need to pass the method as parameter.

    But in C# we have other option as well, we have two generic delegates :

    1. Func<T,TResult>
    2. Action<T>

    Hope it helps!


    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered"Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


    Blog | LinkedIn | Stack Overflow | Facebook
    profile for Ehsan Sajjad on Stack Exchange, a network of free, community-driven Q&A sites




    • Edited by Ehsan Sajjad Tuesday, July 11, 2017 3:49 PM
    • Proposed as answer by Mauricio Feijo Tuesday, July 11, 2017 3:50 PM
    • Marked as answer by Ronald Rex Tuesday, July 11, 2017 4:22 PM
    Tuesday, July 11, 2017 3:47 PM