[Python.NET] RE: example of calling Python from C# with simple object marshalling

Brian Lloyd brian at zope.com
Wed Nov 19 23:32:30 EST 2003


> Just a nitpick: I don't think you can compile:
> 
> int i = thing.ToObject() as Int32
> 
> ...since "i" is a value type, and the 'as' operator can only be used on
> reference types (value types cannot hold null). But I get your point...

Sorry - I dashed that note out between meetings :) Should be

  Thing t = value.ToObject() as Thing

or

  int i = (int)value.ToObject()

Sounds like we agree that this is simple enough not to worry 
about IConvertible for now.

So I will look at getting

  object[] Invoke(params object[] args)

  object ToObject()

checked in for PyObject for b4 (I had to make a b3 tonight, since 
a lot of people were getting bitten by a startup issue).


Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com




More information about the PythonDotNet mailing list