Child to Parent linking - bad idea?
Posted
by
Thraka
on Programmers
See other posts from Programmers
or by Thraka
Published on 2012-11-22T02:33:28Z
Indexed on
2012/11/22
5:11 UTC
Read the original article
Hit count: 145
c#
|programming-practices
I have a situation where my parent knows about it's child (duh) but I want the child to be able to reference the parent. The reason for this is that I want the child to have the ability to designate itself as most important or least important when it feels like it. When the child does this, it moves it to the top or bottom of the parent's children.
In the past I've used a WeakReference property on the child to refer back tot he parent, but I feel that adds an annoying overhead, but maybe it's just the best way to do it.
Is this just a bad idea? How would you implement this ability differently?
© Programmers or respective owner