Creating a C# Nullable Int32 within Python (using Python.NET) to call a C# method with an optional int argument -


I am using C # assembly to call C # code from Python. It works very well, but there has been one such issue calling me that looks like this:

A method within us Namepace.Proj.MyRepo:

  Output Object GetData (String User, IIT, Int. AoopationalID = Faucet)  

I can call the method for that case Where alternate third argument exists, but the argument of matching the third tap case

  Import clr clr.AddReference ("Our.Namespace.Proj") Import from our namespace. Import the import MyRepo _repo = MyRepo () _repo.GetData ('me', System.Int32 (1), System.Int32 (2)) # works! _repo.GetData ('me', System.Int32 (1)) # fails! TypeError: arguments that match any method _repo.GetData ('me', System.Int32 (1), none) # Fails! TypeError: No argument given in match matches  

iPython notebook indicates that the last argument type should be:

  System.Nullable`1 [ System.Int32]  

How to create an object matching the null case.

Any suggestions about creating C # recognized tap object? I believed to pass the original Python that no one would work, but it is not.

I have the same problem with null preference - I think Python.NET does not support these types Does I got the problem by adding the following code to Python. From time to time. Converter Manage () (\ src \ runtime \ converter.cs)

  if (obType.IsGenericType & ampType .GetGenericTypeDefinition () == Typef (nullable < )) {If (value == runtime.php) {result = zero; Back true; } // set type is the built-in type obType = obType.GetGenericArguments () [0]; }  

I kept this code right below

  if (value == runtime.panone & amp; obType.IsValueType) {result = zero; Back true; }  


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -