'Create class graph from exist .net classes

i have system of classes like this:

public class A
{
   B b;
   string str1;
   int    int1;
}
public class A
{
   B b;
   string str1;
   int    int1;
}
public class B
{
   C c;
   D d;
   int    int2;
}
public class C
{
   int    int3;
}
public class D
{
   int    int4;
}

and I would like to generate graph from exist classes, something like this (I want to generate some GraphQL requests):

{
    A {
        B {
            C {
                int3
            }
            D {
                int4
            }
            int2
        }
    }
    str1
    int1
}

How I can do that extremely gracefully?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source