c# - Sending a class as a parameter to a thread? -
so trying find way dynamically pass class type thread, can recall class issued by, , thereby dynamically return data class again.
here trying, serverclass class of main function:
public static void main() { udpclass clsudp = new udpclass(); thread clsudpthread = new thread(new threadstart(delegate() { clsudp.udplisten(64000, serverclass); })); clsudpthread.start(); }
this receiving end, in udpclass:
public void udplisten(int udpport, type oldclass) { }
you can lot code this.
class x : baseclass { ... } class y : x { int yfield; } ... int main(baseclass instance) { if (instance y) (instance y).yfield = 1; }
Comments
Post a Comment