Once you have your PropertyInfo
(from GetProperty
), you need to call GetValue
and pass in the instance that you want to get the value from. In your case:
d.GetType().GetProperty("value2").GetValue(d, null);
More Related Contents:
- How to create an object during runtime in .net
- System.Linq.Expression.Compile error
- Extension method and dynamic object
- How does having a dynamic variable affect performance?
- Dynamic WHERE clause in LINQ
- Dynamically Add C# Properties at Runtime
- Is the use of dynamic considered a bad practice?
- Deserialize XML To Object using Dynamic
- how to create an animated gif in .net
- Dynamically adding properties to an ExpandoObject
- Passing dynamic object to C# method changes return type
- Will the dynamic keyword in C#4 support extension methods?
- Why does a method invocation expression have type dynamic even when there is only one possible return type?
- Create DataTemplate in codebehind
- When should one use dynamic keyword in c# 4.0?
- Removing dynamically created controls in C#
- How to implement a rule engine?
- Creating an anonymous type dynamically? [duplicate]
- How do I check if a property exists on a dynamic anonymous type in c#?
- Working with C# Anonymous Types
- How do I create 5 buttons and assign individual click events dynamically? [closed]
- Lots of first chance Microsoft.CSharp.RuntimeBinderExceptions thrown when dealing with dynamics
- Why does this (null || !TryParse) conditional result in “use of unassigned local variable”?
- How can I convert a DataTable into a Dynamic object?
- How can I get the values of the parameters of a calling method?
- C# dynamic type gotcha
- Null-coalescing operator returning null for properties of dynamic objects
- How to create own dynamic type or dynamic object in C#?
- Why can’t I index into an ExpandoObject?
- C# Dynamic Keyword — Run-time penalty?