日期:2014-05-17  浏览次数:20664 次

菜鸟的简单问题:序列化问题,这段代码的含义。
protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            graphicsList = new DrawList();
  
            int n = info.GetInt32(entryCount);
            string typeName;
            DrawObject drawObject;
  
            for (int i = 0; i < n; i++)
            {
                typeName = info.GetString(String.Format(CultureInfo.InvariantCulture,"{0}{1}",entryType, i));
  
                drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(
                    typeName);
  
                drawObject.LoadFromStream(info, i);
  
                graphicsList.Add(drawObject);
            }
  
        }


为什么要info.GetInt32()? 

------解决方案--------------------
从 SerializationInfo 存储区中检索一个 32 位有符号整数值。
http://msdn.microsoft.com/zh-cn/library/2t208w9f(v=vs.80).aspx
------解决方案--------------------
http://www.codeproject.com/Articles/8494/DrawTools