Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

Object Ref vs Delegate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Inictus - 03 Mar 2008 22:28 GMT
Greetings all,

Obviously I have a question. I have a set of classes in an N-tiered
environment (based on an older version of Rockford Lhotka's CSLA
architecture) and have a situation where I need to notify a parent
object that something has happened in a child object, similar to an
event.

After the parent has deserialized back to the client, I have 2 choices
(unless there is something completely different that Im not
considering), send the children objects a reference to the parent
object, or send a delegate such that these children can invoke it when
need be.

The question is - which would be better in this situation? In terms of
memory footprint, my gut tells me the footprint would be about the
same for either. Is there any other reason to choose one over the
other?

Thanks
Michael C - 04 Mar 2008 03:58 GMT
> Greetings all,
>
> Obviously I have a question.

Who would have thought? :-)

> I have a set of classes in an N-tiered
> environment (based on an older version of Rockford Lhotka's CSLA
[quoted text clipped - 12 lines]
> same for either. Is there any other reason to choose one over the
> other?

The reference to the parent has other uses, if the child needs to find other
properties of it's parent then it can.

> Thanks
Mr. Arnold - 04 Mar 2008 19:59 GMT
> Greetings all,
>
[quoted text clipped - 14 lines]
> same for either. Is there any other reason to choose one over the
> other?

I couldn't tell you one way or the other. I do know that you can email
Rockford, which is at his Web site, he will reply to you. There is also a
CSLA forum.
Inictus - 06 Mar 2008 17:25 GMT
Thanks for the responses.

As for Michael's point, there is value in having a parent reference
for other things, but I don't think I need it beyond notification that
something has happend.

I've looked in the CSLA forum, and since im using a really old (yet
heavily modified) version of the framework (the thought of upgrading
to the latest scares the heck out of me), its hard to find posts
regarding older versions.

I do have a question should I go the delegate route:

If I statically declare delegates in the classes, do I have to worry
about disposing them come garbage collection time? Or will I get a
memory leak if I do nothing.
Mr. Arnold - 07 Mar 2008 12:33 GMT
> Thanks for the responses.
>
[quoted text clipped - 12 lines]
> about disposing them come garbage collection time? Or will I get a
> memory leak if I do nothing.

I can't tell you myself. You're going to have to play. I suggest you make
contact with Rocky. I have emailed him a couple for times. He does get back
to you quickly.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.