© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
33 replies
mae ling

✅ How do i pass a function with unknown parameters?

for instance

void WrapFunction()
{
    return 1;
}

void WrapFunctionA(dynamic data);
void WrapFunctionB(int data);
void WrapFunctionC(string data);

void CallFunction(Func<?> passed_func) { passed_func(); }

CallFunction(WrapFunctionA);
CallFunction(WrapFunctionB);
void WrapFunction()
{
    return 1;
}

void WrapFunctionA(dynamic data);
void WrapFunctionB(int data);
void WrapFunctionC(string data);

void CallFunction(Func<?> passed_func) { passed_func(); }

CallFunction(WrapFunctionA);
CallFunction(WrapFunctionB);

```
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to pass parameters to a Func
C#CC# / help
3y ago
❔ ✅ Pass A Function To Another Function?
C#CC# / help
3y ago
Get Object of unknown type with unknown parameters from string
C#CC# / help
2y ago
(MONOGAME )How to pass a method with parameters to the update method
C#CC# / help
17mo ago