UnityScript How To Deserialize?

When I try to deserialize using this piece of code, it comes up with an error - there’s no semicolon in the second line?

var Binary : BinaryFormatter = new BinaryFormatter();
var TempIntList = (List.<int>)Binary.Deserialize(File);

Any ideas?


You seem to have gotten some confusion between UnityScript and C#

In C# generics are done using List and in UnityScript it’s done using List.

And in C# casting is done using (type)value while in UnityScript it’s value as type

You need to use the right syntax for the right language. You can’t just mix and match :wink:

Hope this helps,