byte []到ArrayList?

the*_*ost 4 c# serialization byte arraylist windows-mobile

有人可以告诉我如何在Windows Mobile下使用C#将byte []转换为ArrayList?

稍后编辑:

  1. 这就像拥有一个包含自定义类型实例的ArrayList.此列表作为字节数组转发到数据库(转换为blob)(转换由数据库API完成); 我想要的是将byte []还原为ArrayList;

  2. .NET CF不提供BinaryFormatter;

the*_*oop 13

所有数组都继承ICollection,因此您可以使用

ArrayList list = new ArrayList(bytearray);
Run Code Online (Sandbox Code Playgroud)

虽然我会使用相同的方法自己使用通用List <byte>,因为这可以防止数组中每个字节值的装箱.虽然数组不会静态地继承相应类型的通用IList,但CLR会在运行时向每个数组实例添加相关实现(请参阅此处的重要说明)