Is there a way to create a delegate to get and set values for a FieldInfo?

As Peter Ritchie suggested, you can compile your own code at runtime. The method will be compiled as soon as you invoke the delegate for the first time. So the first call will be slow, but any subsequent call will be as fast as you can get in .NET without unmanaged pointers/unions. Except for the … Read more

What’s the difference between Dependency Property SetValue() & SetCurrentValue()

The MSDN link you provided says it quite well: This method is used by a component that programmatically sets the value of one of its own properties without disabling an application’s declared use of the property. The SetCurrentValue method changes the effective value of the property, but existing triggers, data bindings, and styles will continue … Read more

Setting a property by reflection with a string value

You can use Convert.ChangeType() – It allows you to use runtime information on any IConvertible type to change representation formats. Not all conversions are possible, though, and you may need to write special case logic if you want to support conversions from types that are not IConvertible. The corresponding code (without exception handling or special … Read more

tech