473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Dynamic Function Calls

I am using C# and I am trying to call one of a group of functions that will be determined at runtime.

I don't want to use a case statement which will compare the function name that I want to call and then call that function.

What I want is like the execute command in VBS where you can execute a string (the string containing the function and it parameters).

Does this make sense?

-Steven
Aug 1 '07 #1
1 943
TRScheel
638 Expert 512MB
Sounds like you want a delegate.

Basically it works like this:

Declare Delegate
Attach function(s) to delegate
Invoke Delegate, which in turn, runs each function attached to it
Disattach/attach more functions
Repeat at invoke step
Aug 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Timothy Stark | last post by:
Hello folks, I am working on my program and was trying to implement 'dynamic' classes by using virtual function calls but it did not work. I want to convert from 'class test1' to 'class test2'...
3
by: MikeY | last post by:
Hi Everyone, I am working in C#, windows forms.My question is this. All my button dynamic controls properties are present and accounted for except for the"FlatStyle" properties. I can't seem to...
9
by: Gibby Koldenhof | last post by:
Hiya, Terrible subject but I haven't got a better term at the moment. I've been building up my own library of functionality (all nice conforming ISO C) for over 6 years and decided to adopt a...
5
by: Sam Steingold | last post by:
I have a main program and an add-on module that uses some functionality in the main program. E.g., the main program main.c has function foo(). The add-on module in file addon.c calls foo(). I...
0
by: Rick | last post by:
I am developing a user control that builds dynamic forms taken from a string (str_output). I have a string such as <table><tr><td><asp:checkbox id="chk1" runat="server" /><asp:checkbox...
1
by: Chris Curvey | last post by:
I'm trying to track down a performance issue in my Windows code, and hotshot is telling me that the most time and calls are spent in these methods ncalls tottime percall cumtime percall...
13
by: Jess | last post by:
Hello, I have some questions to do with dynamic binding. The example program is: #include<iostream> using namespace std; class A{
14
by: vivek | last post by:
i have some doubts on dynamic memory allocation and stacks and heaps where is the dynamic memory allocation used? in function calls there are some counters like "i" in the below function. Is...
0
by: ilanbm | last post by:
Hi We have an odbc driver that we wrote. This is actually a shared object which implements a set of SQLxxx functions. There is also another shared object that we did not write, which is the odbc...
5
by: mike.m.schmidt | last post by:
Hello, I've been trying to optimize a piece of code that executes in 6 milliseconds. From what I have read, dynamically managing memory with new/malloc and delete/free is less efficient than...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.