7.Array对应的就是.net中的ArrayList对象,该对象首先使用32位整数定义了ArralyList的长度,然后是密集的跟着ArrayList中的对象,读取该对象使用如下函数:

  1. private ArrayList ReadArray()  
  2. { int size = ReadInt32();  
  3.  ArrayList arr = new ArrayList(size);  
  4.  for (int i = 0; i < size; ++i)  
  5.  {arr.Add(ReadData(ReadByte())); }  
  6.  return arr;}  

8.Date对应.net中的DateTime数据类型,Date在类型标识符0x0B后使用double来表示从1970/1/1到表示的时间所经过的毫秒数,然后再跟一个ushort的16位无符号整数表示时区。读取Date类型的C#代码为:

  1. private DateTime ReadDate()  
  2.  {double ms = ReadDouble();  
  3. DateTime BaseDate = new DateTime(1970, 1, 1);  
  4. DateTime date = BaseDate.AddMilliseconds(ms);   
  5. ReadUInt16(); //get's the timezone   
  6. return date; }  

9.LongString对应的也是string类型,不过和2对应的String不同的是这里使用32位整数来表示字符串的UTF8长度,而String使用的是16位。

10.XML是使用类型标识符0x0F后直接跟LongString类型的字符串表示。


相关内容