List method creation

Posted by Jonathan D on Stack Overflow See other posts from Stack Overflow or by Jonathan D
Published on 2010-04-27T09:15:53Z Indexed on 2010/04/27 9:23 UTC
Read the original article Hit count: 257

Filed under:
|
|

I'm creating a list of my defined objects like so

List<clock> cclocks = new List<clocks>();

for each object in the list i'm calling a method moveTime, like so

foreach(clock c in cclocks)
{
    c.moveTime();
}

is the a way i can write some cleaver thing so i can call

cclocks.moveTime();

it would then go though the list doing that method

I guess I want to create a collection method?

I'm guessing there must be some thing I can do I just don't know what.

thanks for your help

© Stack Overflow or respective owner

Related posts about c#

Related posts about collections