'Iterate through non public member data

Running the risk of being shouted down for lack of examples but I'm trying to access all of the property names/values from a list of non public members of an object:

enter image description here

Tried this which returns null:

var temp = (cbBasket).GetType().GetProperties().ToDictionary(p => p.Name, p => p.GetValue(cbBasket));

And this which returns the type but not the value + plus the list contained over 90 key value pairs so I doubt if this is correct (!)

            Type myBasket = cbBasket.GetType();
            var myMemberInfo = myBasket.GetMembers();

            for (int i = 0; 1 < myMemberInfo.Length; i++)
            {
                var zString = myMemberInfo[i].Name + " " + myMemberInfo[i].MemberType;
            }

Any help would be greatly appreciated. Thanks, C



Sources

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

Source: Stack Overflow

Solution Source