can you typecast a .NET object in IronPython?

前端 未结 4 2156
Happy的楠姐
Happy的楠姐 2021-01-05 07:35

I\'m interfacing with a .NET API in IronPython. The API is returning an object of the wrong type (some kind of generic object). I suspect that the problem is not showing up

4条回答
  •  情深已故
    2021-01-05 08:23

    If you need to cast numeric value to an enum use the following, because the code above does not work for enums, but only for reference types:

    Enum.ToObject(CustomEnumType, value)
    

提交回复
热议问题