0

I am currently making a console application. What I am looking for is a way to reference a method reminiscent to that of a constructor, for example:

Method1(Method2){}. 

I know I can put variables, but methods I do not know. Is there a way?

Trevor
  • 7,777
  • 6
  • 31
  • 50
  • 1
    "reffrence a method remmenisent to that of a constructor" - what..? – Code Stranger Oct 28 '21 at 16:10
  • 2
    Does this answer your question? [Pass Method as Parameter using C#](https://stackoverflow.com/questions/2082615/pass-method-as-parameter-using-c-sharp).. I'm not super sure on this though. It's a little unclear what you're asking. – Broots Waymb Oct 28 '21 at 16:11
  • Yes, if the argument of Method1 is of type `Action` or `Func` and these have the same type arguments Method2 has. For example if you have `int Method2(string text)` and `void Method1(Func method)` (i.e. a function with one string input and a int output) then you can call `Method1(Method2)`. – ckuri Oct 28 '21 at 16:12

0 Answers0