I'd like to dynamically set a list of custom event handlers something like this in pseudo-code:
FieldInfo[] fieldInfos = this.GetType().GetFields(
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
foreach (FieldInfo fieldInfo in fieldInfos)
{
if this.fieldInfo.GetType() = TypeOf(CustomEventHandler<this.fieldInfo.Name>) {
this.fieldInfo.Name += new CustomEventHandler<this.fieldInfo.Name>(OnChange<this.fieldInfo.Name>);
}
}
I can't find the right syntax can you ?