I was a little sketchy on what you wanted to accomplish. I think you want to start with ClassA and eventually walk through the properties and get to ClassC. To do this you mostly have to understand how to do recursive programming and a small amount of knowledge of Reflection. Here is a modified version of code that I have used in the past, which you can find here.
private void SerializeObject(object obj) {
Type type = obj.GetType();
foreach (PropertyInfo info2 in type.GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
{
MethodInfo getMethod = info2.GetGetMethod(true);
if (getMethod != null)
SerializeObject(getMethod.Invoke(obj, null));
}
}
What this does is walk through each property and uses the get method of each property to execute the property and get the object that is being returned so that you can walk through it by calling the same SerializeObject
method.