from System.Runtime.Serialization.Formatters.Binary import BinaryFormatter
from Spotfire.Dxp.Data import BinaryLargeObject
from System.IO import MemoryStream
# serialization
l = ['dog','cat']
s = MemoryStream()
try:
bf = BinaryFormatter()
bf.Serialize(s,l)
# moving to position 0 of stream, as BinaryLargeObject will try to read from it
s.Position = 0
data = BinaryLargeObject.Create(s)
Document.Properties['SeriallizedList'] = data
finally:
s.Dispose()
# deserialization (separate script, copy imports)
stream2 = Document.Properties['SeriallizedList'].GetByteStream()
bf2 = BinaryFormatter()
l2 = bf2.Deserialize(stream2)
for item in l2:
print item
Source: https://tibbr.tibcommunity.com/tibbr/#!/messages/159499
from Spotfire.Dxp.Data import BinaryLargeObject
from System.IO import MemoryStream
# serialization
l = ['dog','cat']
s = MemoryStream()
try:
bf = BinaryFormatter()
bf.Serialize(s,l)
# moving to position 0 of stream, as BinaryLargeObject will try to read from it
s.Position = 0
data = BinaryLargeObject.Create(s)
Document.Properties['SeriallizedList'] = data
finally:
s.Dispose()
# deserialization (separate script, copy imports)
stream2 = Document.Properties['SeriallizedList'].GetByteStream()
bf2 = BinaryFormatter()
l2 = bf2.Deserialize(stream2)
for item in l2:
print item
Source: https://tibbr.tibcommunity.com/tibbr/#!/messages/159499
ConversionConversion EmoticonEmoticon