Efficient code to avoid circular references in c# object model

Posted by Kumar on Stack Overflow See other posts from Stack Overflow or by Kumar
Published on 2010-03-19T02:28:30Z Indexed on 2010/03/19 2:31 UTC
Read the original article Hit count: 371

Filed under:
|
|

I have an excel like grid where values can be typed referencing other rows

To check for circular references when a new value is entered, i traverse the tree and create a list of values referenced thus far, if the current value is found in this list, i return an error thus avoiding a circular reference. This is infrequent enough where extreme performance is not an issue but...

Question - is there a better way ? I'm told it's not the most optimal but no answer was provided so on to the experts @ SO :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about Performance