Use BindingFlags.NonPublic
and BindingFlags.Instance
flags
FieldInfo[] fields = myType.GetFields(
BindingFlags.NonPublic |
BindingFlags.Instance);
More Related Contents:
- How to get the list of properties of a class?
- How do I get the path of the assembly the code is in?
- Set object property using reflection
- How to create a new object instance from a Type
- How do I use reflection to invoke a private method?
- Correct Way to Load Assembly, Find Class and Call Run() Method
- How costly is .NET reflection?
- Getting all types in a namespace via reflection
- What are attributes in .NET?
- Read the value of an attribute of a method
- Get all derived types of a type
- How does WCF deserialization instantiate objects without calling a constructor?
- GetMethod for generic method [duplicate]
- AddEventHandler using reflection
- Discovering derived types using reflection
- How do I create a generic class from a string in C#? [duplicate]
- How to hide public methods from IntelliSense
- Why GetType returns System.Int32 instead of Nullable? [duplicate]
- Determine if a type is static
- How to find out if a property is an auto-implemented property with reflection?
- Why do some C# lambda expressions compile to static methods?
- Using GetProperties() with BindingFlags.DeclaredOnly in .NET Reflection
- Finding property differences between two C# objects
- Create object instance of a class from its name in string variable
- Look if a method is called inside a method using reflection
- Finding all classes with a particular attribute
- How do I check if a type provides a parameterless constructor?
- Using Reflection to create a DataTable from a Class?
- Get private Properties/Method of base-class with reflection
- Why is the use of reflection in .NET recommended?