471,337 Members | 978 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Encapsulate a method...

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
Dec 5 '05 #1
5 1562

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message
news:43***********************@news.sunsite.dk...
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.
Dec 5 '05 #2
Hi,

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

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message
news:43***********************@news.sunsite.dk...
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

Dec 5 '05 #3
Look at the delegates.
I hope this MSDN article could shed some light on the matter

http://msdn.microsoft.com/library/de...estutorial.asp
--

Stoitcho Goutsev (100) [C# MVP]

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message
news:43***********************@news.sunsite.dk...
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

Dec 5 '05 #4
Hi
Look at the delegates.
I hope this MSDN article could shed some light on the matter

http://msdn.microsoft.com/library/de...estutorial.asp


Thank you very much for all of you replies, I works great...

Regards
Thorbjørn
Dec 6 '05 #5
Hi again...
Hi
Look at the delegates.
I hope this MSDN article could shed some light on the matter

http://msdn.microsoft.com/library/de...estutorial.asp


Thank you very much for all of you replies, I works great...

.... it works greatly!

Regards
Thorbjørn
Dec 6 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Dave Rahardja | last post: by
reply views Thread by beyond | last post: by
3 posts views Thread by charliewest | last post: by
2 posts views Thread by Matt | last post: by
6 posts views Thread by TBass | last post: by
1 post views Thread by Jason Huang | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.