Check if an object is non-basetype?
<p>I want to be able to see if an object is of a base type (char, int, var, string (is this a base type in C#?)). The reason for this is because I want to create a parser, which gets the fields of the object and if it comes across an object it cannot get a value out of (if it was another object inside), it will recursively get the fields out of there too. So for instance:</p>

<pre><code>    for (int x = 0; x &lt; elements.Length; x++)
    {
        FieldInfo currenField = fields[x];

        if (currenField is object) //This doesn't work because its of type "FieldInfo"
        {
            //pass in the current object into the function
        }
        else
        {
            elements[x] = new XElement(currenField.Name, currenField.GetValue(obj).ToString());
        }
</code></pre>

<p>unfortunately I cannot seem to find anything online this will allow you to easily figure out if its a base type. The following is not possible either:</p>

<pre><code>      currenField.GetType is typeof(object)
</code></pre>

<p>TLDR; I cannot determine if something is a base type or not, nor can I compare types to produce the same effect</p>

<p>Any help is greatly appreciated!</p>
