h.GetType().GetMethod()

On Sun, May 31, 2009 at 3:42 AM, Henrik Feldt <[email protected]> wrote:

>  This blows up:
>
>
>
> <?brail
>
> 1: import System
>
> 2: h = FormHelper
>
> 3: settingMap = { "editor":h.TextArea } // there’ll be more setting keys
> coming here
>
> 4: output settingMap["editor"]("testing", {...@class:"wymeditor"}) ?>
>
>
>
> With:
>
> *Method 'Castle.MonoRail.Framework.Helpers.FormHelper.TextArea' not found.
> *
>
> * *
>
> Stacktrace:
>
> Line 137:                      if (null == type)
>
> Line 138:                      {
>
> Line 139:                             return 
> target.GetType().InvokeMember(name,
>
> Line 140:                                                                  
> ResolveFlagsToUse(target.GetType(), GetPropertyBindingFlags),
>
> Line 141:                                                                  
> null,
>
>
>
> [MissingMethodException: Method
> 'Castle.MonoRail.Framework.Helpers.FormHelper.TextArea' not found.]
>
>    System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags,
> Binder binder, Object target, Object[] providedArgs, ParameterModifier[]
> modifiers, CultureInfo culture, String[] namedParams) +2172
>
>    System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
> binder, Object target, Object[] args) +28
>
>
> Castle.MonoRail.Views.Brail.ExpandDuckTypedExpressions_WorkaroundForDuplicateVirtualMethods.GetProperty(Object
> target, String name) in
> ExpandDuckTypedExpressions_WorkaroundForDuplicateVirtualMethods.cs:139
>
>    BrailView_test.Run() +67
>
>    Castle.MonoRail.Views.Brail.BooViewEngine.RenderView(String
> templateName, BrailBase view)
>
>
>
> Problem:
>
> It assumes I want to invoke the method without parameters (which obviously
> doesn’t exist), when I want a reference to it on line 3, so I can fold the
> method invocations into a map and invoke them per type/key. Here is where I
> would really love dynamic typing, because I don’t know all combinations
> before invocation.
>
>
>
> Any ideas about how to fix?
>
>
>
> Cheers
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to