Is There a C#.Net Equivalent to Objective-C's Selector -


this c#.net question objective-c developers work c#.net

as know, objective-c can parse method name selector; , method can belong outside class.

i able use type of method in c#.net lot cleaner creating loads of events can become messy , hard manage.

if possible, how can achieve this? thank you!

example:

public class main {     public void myprocess(callback tomethod)     {         // fancy stuff , send callback object                tomethod(result);     } }  public class {     public void runmethod()     {         myprocess(method1);         myprocess(method2);     }      private void method1(object result)     {         // stuff callback     }      private void method2(object result)     {         // stuff callback     } } 

i don't know objective-c, think want this:

public class main {     public void myprocess(action<object> tomethod, object result)     {         // fancy stuff , send callback object                tomethod(result);     } }  public class {     public void runmethod()     {         object result = new object();         myprocess(method1, result);         myprocess(method2, result);     }      private void method1(object result)     {         // stuff callback     }      private void method2(object result)     {         // stuff callback     } } 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -