iterate through class, creating a serializeable object
<pre><code>public partial class VALUES
{
    public struct Status
    {
        public const long Registered = 5;
        public const long Active = 6;
    }
}
</code></pre>

<p>I would like to dynamically create an anonymous object which i can serialize to JSON based on this class. Is there any way to iterate through the properties of the class above, to create something like this:</p>

<pre><code>new JavaScriptSerializer.Serialize(new {
    Values = new
                {
                    Status = new
                    {
                        Registered = VALUE.Status.Registered,
                        Active = VALUE.Status.Active,
                    },

                } ....
</code></pre>

<p>Not sure if the code above compiles, just wanted to give you an idea of what im trying to achieve. Instead of mapping each value manually i would like to create the values dynamically. Thanks</p>
