首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

关于序列化,这段代码中,为什么要info.GetInt32()?该怎么处理

2014-01-01 
关于序列化,这段代码中,为什么要info.GetInt32()?protected GraphicsList(SerializationInfo info, Stream

关于序列化,这段代码中,为什么要info.GetInt32()?

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);
            }
 
        }

[解决办法]
GetInt32从 SerializationInfo 存储区中检索一个 32 位有符号整数值。

热点排行