Encapsulate a method...

  • Thread starter Thorbjørn Jørgensen
  • Start date
T

Thorbjørn Jørgensen

Hi
How can I encapsulate a specific method from a specific object? I have some
different object with different methods, and I would like that the object
could put a reference to one of its methods into a common arraylist. A
control element should then at a later time, go through the arraylist and
execute the methods, but I do not know how to encapsulate the methods to put
then into the arraylist?

Hope that my question is somehos understandable, and that someone can
help...

Regards
Thorbjørn
 
M

Mike Schilling

Thorbjørn Jørgensen softdoc.dk> said:
Hi
How can I encapsulate a specific method from a specific object? I have
some different object with different methods, and I would like that the
object could put a reference to one of its methods into a common
arraylist. A control element should then at a later time, go through the
arraylist and execute the methods, but I do not know how to encapsulate
the methods to put then into the arraylist?

Look into delegates.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You can use an array of delegates ( or a ArrayList if the number of element
change) .

cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top