PC Review


Reply
 
 
Peter Schall
Guest
Posts: n/a
 
      17th May 2011
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
}
}
}

 
Reply With Quote
 
 
 
 
Peter Schall
Guest
Posts: n/a
 
      17th May 2011
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.


Peter Schall wrote:

> 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
> }
> }
> }


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can we declare delegates in class and can we declare delegates in Interface Bhuwan Bhaskar Microsoft Dot NET Framework 4 4th Oct 2007 05:25 AM
Advanced use of delegates to automatically disconnect delegates from a set of events kristian.freed@gmail.com Microsoft C# .NET 2 18th Nov 2006 09:56 PM
PinvokeDLL or delegates or ??? ... Calling C# delegates from C++ as CALLBACK Roland Rehmnert Microsoft Dot NET Compact Framework 1 20th Feb 2005 12:21 PM
Help with delegates OpticTygre Microsoft VB .NET 2 18th Feb 2005 01:47 PM
Delegates will be the end of me Todd Microsoft C# .NET 2 8th Jul 2004 03:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:09 AM.