I'm digging into Reflection for the first time and I'm truely stuck. I've googled everything I can think of. I'm 90% where I wanna be now.
I'm trying to return the value of a Property in a custom class through Reflection.
Here's my class declaration:
Public Class Class2
Private newPropertyValue2 As String
Public Property NewP...
I'm writing a file generic block for my application and started with using Lambda expressions for managing my rule sets for block generation to avoid the pitfalls of magic strings, configuration hell etc.
Inside my mapping class I have lines similar to:
Map(x => x.Name).Length(20).PadLeft(true).PaddingChar("#");
This works fine and i...
How do you create a read-only dependancy property? What are the best-practices for doing so?
Specifically, what's stumping me the most is the fact that there's no implementation of
DependencyObject.GetValue()
that takes a System.Windows.DependencyPropertyKey as a parameter.
System.Windows.DependencyProperty.RegisterReadOnly returns...
As already discussed in Rtti data manipulation and consistency in Delphi 2010 a consistency between the original data and rtti values can be reached by accessing members by using a pair of TRttiField and an instance pointer. This would be very easy in case of a simple class with only basic member types (like e.g. integers or strings).
Bu...
Hey Guys,
I have a propertyInfo object and I try to do a GetValue using it.
object source = mysourceObject //This object has a property "Prop1" of type Collection<>.
var propInfo = source.GetType().GetProperty("Prop1");
var propValue = prop.GetValue(this, null);
// do whatever with propValue
// ...
I get error at the GetValue() ca...
I have a method that has the following signature:
private object GetNestedObject<y>(y objToAccess, string nestedObjectName)
I'm using Reflection to get the nestedObject from the objToAccess and return it.
This works well except it's really slow (I have to do this a few hundred thousand times).
I came across HyperDescriptor, but sinc...