Users Pricing

forum

Home Forums Dynamically invoke method in c# – MindStick

Dynamically invoke method in c#

Anonymous User 3165 05 Mar 2013

Hi Everyone!

I want to be able to store function reference and disregard arguments until it actually is used.

Here's what I'd like for it to look like:

StoreType f=MyFunction;
.......
var r=f.Invoke(arg1,arg2,arg3) as ReturnType;
This is kind of like Action and Func, but those are strongly typed, and I want to be able to declare and use this type without precisely knowing how many arguments and of what types the function will take.

How do I do this in c#?

Thanks!


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md