Jeff wrote:
> I've got some functions implemented in C# that need to have optional,
> defaulted parameters. So far I've been declaring them similar to:
> 
>     public object cursor(CodeContext context,
> [Optional][DefaultValue(null)]object factory)
> 
> However, if factory is not specified, instead of being set to null,
> it's a System.Reflection.Missing instance. Removing the DefaultValue
> or changing the order doesn't change the outcome. Is this expected
> behaviour?

I think removing optional should give you the correct behavior - if that
Works then yes it is the expected behavior :).  

I guess we're checking for Optional before DefaultValue and for Optional we 
are matching the reflection behavior of passing Missing.Value.  It also gives
you a way to disambiguate whether the user passed None/null or if they 
didn't provide the parameter.

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to