Skip to content

Instantly share code, notes, and snippets.

@jasondown
Created August 3, 2021 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondown/861b01e45411e9fbb5c32d3948596c52 to your computer and use it in GitHub Desktop.
Save jasondown/861b01e45411e9fbb5c32d3948596c52 to your computer and use it in GitHub Desktop.
public class NavObjectNode
{
private readonly int _type;
private readonly int _id;
private readonly List<NavObjectNode> _compositionList;
public NavObjectNode(int type, int id)
{
_type = type;
_id = id;
_compositionList = new List<NavObjectNode>();
}
public IList<NavObjectNode> ComposedOf
{
get { return _compositionList; }
}
public int Type
{
get { return _type; }
}
public int Id
{
get { return _id; }
}
public void AddCompositionNavObject(NavObjectNode navObject)
{
// avoid self reference... it happens in tables sometimes
if (navObject.Id == Id && navObject.Type == Type) return;
if (!_compositionList.Contains(navObject))
{
_compositionList.Add(navObject);
}
}
// remaining details omitted
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment