TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kyle_hankinson
NA
58
0
Class interaction
Jan 12 2005 4:43 PM
I have the following command class: namespace socketTest { public class Command { // Hashtable to store strings and delegate private Hashtable commands = new Hashtable(); private delegate void function ( ); // New commands created public Command() { // Associate our delegates with strings commands.Add ( "shutdown", new function ( doShutdownServer ) ); } public void test(string testString ) { IDictionaryEnumerator enumerator = commands.GetEnumerator(); while (enumerator.MoveNext()) if (enumerator.Key.ToString ( ) == testString) ((function)enumerator.Value)(); } private void doShutdownServer ( ) { } } } that is called from my socket class: Command command = new Command(); command.test ( "shutdown" ); Basically what I want to happen is my socket class sends a string to my command class. This string is an index to a function. In this case the function that will be called is doShutdownServer. What I want this function to do is call my server.stop ( ) method but I am unsure of how to do this. My server class is created in my main class. Any ideas on how I could do this would be cool. Thanks.
Reply
Answers (
0
)
Reading description field from SQL server table field
a couple questions