1

There is a Tree with lot of nodes and it goes through, say 4 phases of processing.

In one particular phase, say phase 3, I need few extra properties(integers) to do the required processing.

I am not the creator of the Tree Node classes so I don't want to modify the class and add those properties. besides, those properties are very specific to Phase 3.

What is the best approach I can do to "add" these properties? It will be way too complicated if I wrap every node with a wrapper class, because i have to maintain a dictionary of [NodeID-> Wrapped Node] which is very performance intensive approach. It can easily have 300k nodes so a dictionary can easily go out of memory.

What other approach can I use to solve this problem?

Sabz
  • 361
  • 1
  • 7
  • 18
  • 1
    If dictionary is too "performance intensive" for your case it is very likely that neither wrapper classes nor extension properties would work for you. You may want to clarify your performance requirements so someone can suggest viable approach. – Alexei Levenkov Jul 22 '15 at 07:25
  • Hello Alexei, Thank you for your reply. There are cases which can lead to half a million entries in the dictionary which can cause an outOfMemory exception. I've tried this and it didn't give good results. – Sabz Jul 22 '15 at 08:42
  • 300K does not sound too much... I'd expect trouble starting at millions of entries assuming you are using x64 build (http://stackoverflow.com/questions/7876853/c-sharp-dictionary-how-to-solve-limit-on-number-of-items). – Alexei Levenkov Jul 22 '15 at 15:49
  • @AlexeiLevenkov IN worse case scenarios, it can be a few million entries. – Sabz Jul 29 '15 at 09:09

0 Answers0