Delegates

  • Thread starter Thread starter Peter Schall
  • Start date Start date
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
}
}
}
 
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.
 
Back
Top