[IronPython] Default-valued arguments to C# functions

Dino Viehland dinov at microsoft.com
Mon Apr 26 22:41:31 CEST 2010


Jeff wrote:
> Interestingly, using DefaultValue worked for anything that wasn't an
> object - `[Optional][DefaultValue(-1)]int index` worked just fine.

I think you should have been getting a value of 0 when the parameter
wasn't being provided in this case.  When something is optional but
not typed to object we need to pass default(typeof(T)) instead of passing
Missing.Value.





More information about the Ironpython-users mailing list