Reflection - URGENT

Hi experts ..

I have the following class:

public class ClassA
       private class ClassB
                 public string property;
       private  IDictionary<string, ClassB> dictionary;

How to use reflection to get *property* value of one of the keys in *dictionary* field??

I am getting *dictionary* field as follow:

BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
FieldInfo field = Typeof(ClassA).GetField("dictionary", bindFlags);

but I cannot get value of the dictionary since ClassB is private!!
Who is Participating?
Bob LearnedCommented:
Did you try PropertyInfo instead of FieldInfo?

DrAskeAuthor Commented:
What I want to say that I cannot cast the object obtained from FiledInfo to IDictionary<string, ClassB> since ClassB is a private class!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.