Delegates

P

Peter Schall

Hello,

I try to loop through all child relations and call a specific method I pass
as a parameter. But how is it done correctly, so that the passed method is
called by the relation child. Or any better solution is wellcome.

Thanks Peter


class SQLCursor: Datatable
{
protected delegate bool ChildUpdateHandler();

void UpdateDeleted
{
this.IterateChildRelations(new ChildUpdateHandler(this.UpdateDeleted));
}

void UpdateModified
{
this.IterateChildRelations(new ChildUpdateHandler(this.UpdateModified));
}

bool IterateChildRelations(ChildUpdateHandler doMethod)
{
foreach(DataRelation rel in this.ChildRelations)
{
//doMethod() // just calls itself, but not the rel.Table
//rel.doMethod() // unknown
}
}
}
 
P

Peter Schall

Thank you for your answer. The Code was just a short hand excerpt to show
what I want to succeed. So no return value in the method body....

I will try of your examples.
 

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