Microsoft lists what I would consider "programming primitives" (I understand this is a misnomer) as "Data Types" in their documentation. The list of "Data Type" objects by their metric is thus:
Boolean Byte Char Date Decimal Double Integer Long Object SByte Short Single String UInteger ULong User-Defined UShort
Currently, I am trying to create a function that generates a flat graph from a given object, because I am trying to serialize objects into JSON. The objects that I am working with have many, many circular references that always break the JSON serialize-r because it exceeds the recursion limit.
My Question:
How can I tell using introspection, reflection, what-have-you, intelligently, if an object is a "Pure" data type? As in: the object is a Boolean, Byte Char, etc, etc, not an object that simply inherits from Boolean Byte, or Char, etc.
My Reasoning:
What I hope to accomplish, is that as I recursively traverse through a given object, and am generating a flat structure from that, that I can hold onto object references in a list, and "skip" over objects that I have already hit, and just assign those Guids. The Guid will live in the JSON with the reference to the object, but for all intents and purposes (from the JSON serialize-r side of things), the circular references will be broken, allowing it to serialize.
However, things like strings, bools, nulls, those are easily describable in JSON. Is there a way as I'm checking if I have cataloged the object already, to also check if the object is a "pure Data Type"? To clarify, I still want to write strings, ints, bools, nulls, into the JSON even if I have already encountered a reference to those items.
I am also open to alternative solutions, or better ideas. I am trying to wrap my head around the problem better. Thanks in advance!