You can:
typeof(Foo)
.GetField("bar",BindingFlags.Instance|BindingFlags.NonPublic)
.SetValue(foo,567);
More Related Contents:
- How do I get the path of the assembly the code is in?
- Set object property using reflection
- Public Fields versus Automatic Properties
- C# Reflection: How to get class reference from string?
- Difference between Property and Field in C# 3.0+
- Casting a variable using a Type variable
- How do I instantiate a class given its string name?
- Get all derived types of a type
- Using C# reflection to call a constructor
- How To Test if Type is Primitive
- Retrieving the calling method name from within a method [duplicate]
- How can I create an instance of an arbitrary Array type at runtime?
- Using IsAssignableFrom with ‘open’ generic types
- c# Creating an unknown generic type at runtime
- Discovering derived types using reflection
- How do I create a generic class from a string in C#? [duplicate]
- Get all types implementing specific open generic type
- Determine if a type is static
- Dynamic table name in linq [duplicate]
- GetEntryAssembly for web applications
- Why is TargetInvocationException treated as uncaught by the IDE?
- Finding all Namespaces in an assembly using Reflection (DotNET)
- How to get around lack of covariance with IReadOnlyDictionary?
- Get all properties which marked certain attribute
- Using GetProperties() with BindingFlags.DeclaredOnly in .NET Reflection
- Comparing Object properties using reflection
- Using Reflection to create a DataTable from a Class?
- Is there any way to get a reference to the calling object in c#?
- Get private Properties/Method of base-class with reflection
- Reflection Performance – Create Delegate (Properties C#)