public HashSet <TypeRef> AddSelfAndReferencedTypeRefs(HashSet <TypeRef> existingList) { if (!existingList.Add(this)) { return(existingList); } if (NestedIn != null) { NestedIn.AddSelfAndReferencedTypeRefs(existingList); } foreach (var currentWrapped in Wrapped.EmptyIfNull()) { currentWrapped.AddSelfAndReferencedTypeRefs(existingList); } return(existingList); }