Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Last active June 3, 2021 11:09
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 chuongmep/2352f1f8afdec079b500e9dd14b46728 to your computer and use it in GitHub Desktop.
Save chuongmep/2352f1f8afdec079b500e9dd14b46728 to your computer and use it in GitHub Desktop.
private static List<Element> Collector(Element e, Dictionary<string, Element> OutElements)
{
double count = 0;
List<Element> elements = e.GetElementConnectedWith();
foreach (Element item in elements)
{
if (OutElements.ContainsKey(item.Id.ToString()))
{
count += 1;
}
else
{
OutElements[item.Id.ToString()] = item;
Collector(item, OutElements);
}
}
if (Math.Abs(count - elements.Count) < 0.0001)
{
return new List<Element>(OutElements.Values);
}
return new List<Element>(OutElements.Values);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment