I have a list comprehension working with .NET array elements like
obj.arr = [f(x) for x in obj.arr]
However, assigning back obj.arr is not performed.
Is it possible to convert a list to a .NET array in IronPython?
Try the following:
obj.arr = Array[T]([f(x) for x in obj.arr])
replacing T type of array elements.
T
As an alternative:
obj.arr = tuple([f(x) for x in obj.arr])
Arrays should be printed as far as I know. This works for me:
num_list = [n for n in range(10)] from System import Array num_arr = Array[int](num_list)
Similarly for strings and other types.