[Mono-devel-list] Invoke..

Rodrigo B. de Oliveira rbo at acm.org
Sun Jan 16 09:06:51 EST 2005


Object[] args = new object[] {}
foreach (object o in objectList) 
{
     o.GetType().GetMethod("foo").Invoke(o, args);
}

> -----Original Message-----
> From: mono-devel-list-admin at lists.ximian.com 
> [mailto:mono-devel-list-admin at lists.ximian.com] On Behalf Of Auge Mike
> Sent: Sunday, January 16, 2005 11:15 AM
> To: mono-devel-list at lists.ximian.com
> Subject: [Mono-devel-list] Invoke..
> 
> Hi guys,
> 
> I have a Q for you. If I have an array of objects, and each 
> object is of different class type. But all the classes 
> implement a method with the same name and sig. Note that the 
> calsses dose no inherit from a shared interface or class. 
> Also the objects are casted to the class "object". How can I 
> invoke the method using the name in each object?
> 
> Thank you for your help in advance!
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today 
> it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 





More information about the Mono-devel-list mailing list