• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SerializationInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SerializationInfo的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo类的具体用法?C# SerializationInfo怎么用?C# SerializationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SerializationInfo类属于命名空间,在下文中一共展示了SerializationInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AdapterManagementComponent

        /// <summary>
        /// Deserializing contructor.
        /// </summary>
        public AdapterManagementComponent(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _adapters = new GenericContainer<IIntegrationAdapter>();

            _adapters.ItemAddedEvent += new GenericContainer<IIntegrationAdapter>.ItemUpdateDelegate(Adapters_ItemAddedEvent);
            _adapters.ItemRemovedEvent += new GenericContainer<IIntegrationAdapter>.ItemUpdateDelegate(Adapters_ItemRemovedEvent);

            _startedAdaptersIds = (List<ComponentId>)info.GetValue("startedAdaptersIds", _startedAdaptersIds.GetType());

            // Adapters are serialized one by one, to add safety when deserializing (one adapter will
            // otherwise block the entire deserialization for the manager).
            int adaptersCount = (int)info.GetValue("adapterCount", typeof(int));
            for (int i = 0; i < adaptersCount; i++)
            {
                try
                {
                    IIntegrationAdapter adapter = (IIntegrationAdapter)info.GetValue("adapter_" + i, typeof(IIntegrationAdapter));
                    _adapters.Add(adapter);
                }
                catch (SerializationException ex)
                {
                    SystemMonitor.OperationError("Failed to deserialize integration adapter [" + ex.Message + "].");
                }
                catch (InvalidCastException ex)
                {
                    SystemMonitor.OperationError("Failed to deserialize integration adapter [" + ex.Message + "].");
                }
            }

            ChangeOperationalState(OperationalStateEnum.Constructed);
        }
开发者ID:redrhino,项目名称:DotNetConnectTerminal,代码行数:35,代码来源:AdapterManagementComponent.cs


示例2: Message

 public Message(SerializationInfo info, StreamingContext context)
 {
     SourceID = info.GetInt32 ("SourceID");
     DestID = info.GetInt32 ("DestID");
     Type = (MessageType)info.GetByte ("MessageType");
     SerializedContent = (byte[])info.GetValue ("SerializedContent", typeof(byte[]));
 }
开发者ID:Samaed,项目名称:ChickenDodge,代码行数:7,代码来源:Message.cs


示例3: Resource

 public Resource(SerializationInfo info, StreamingContext context)
     : base(1,(string) info.GetValue("type", typeof(string)), null, (string) info.GetValue("description", typeof(string)), null)
 {
     // Reset the property value using the GetValue method.
     tier = (int) info.GetValue("tier", typeof(int));
     use = (int) info.GetValue ("use", typeof(int));
 }
开发者ID:RCARL,项目名称:CS380Unity,代码行数:7,代码来源:Resource.cs


示例4: GetObjectData

 /*[SecurityPermissionAttribute(
             SecurityAction.Demand,
             SerializationFormatter = true)]		*/
 public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
 {
     info.AddValue("x", this.x);
     info.AddValue("y", this.y);
     info.AddValue("z", this.z);
     info.AddValue("w", this.w);
 }
开发者ID:ChubbRck,项目名称:SFB,代码行数:10,代码来源:SerQuaternion.cs


示例5: SaveData

 public SaveData(SerializationInfo info, StreamingContext ctxt)
 {
     mapName = (string)info.GetValue ("mapName", typeof(string));
     playerLocation = (float[])info.GetValue ("playerLocation", typeof(float[]));
     activeQuests = (List<Quest>)info.GetValue ("activeQuests", typeof(List<Quest>));
     completedQuests = (List<Quest>)info.GetValue ("completedQuests", typeof(List<Quest>));
 }
开发者ID:darrare,项目名称:3100,代码行数:7,代码来源:SaveData.cs


示例6: foreach

 void IMobileObject.SetState(SerializationInfo info)
 {
   foreach (string key in info.Values.Keys)
   {
     Add(key, info.Values[key].Value);
   }
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:ContextDictionary.cs


示例7: RuntimeException

 /// <summary>
 /// Initializes a new instance of the RuntimeException class
 /// using data serialized via
 /// <see cref="ISerializable"/>
 /// </summary>
 /// <param name="info"> serialization information </param>
 /// <param name="context"> streaming context </param>
 /// <returns> constructed object </returns>
 protected RuntimeException(SerializationInfo info,
                    StreamingContext context)
         : base(info, context)
 {
     _errorId = info.GetString("ErrorId");
     _errorCategory = (ErrorCategory)info.GetInt32("ErrorCategory");
 }
开发者ID:40a,项目名称:PowerShell,代码行数:15,代码来源:RuntimeException.cs


示例8: GetObjectData

 // Required by the ISerializable class to be properly serialized. This is called automatically
 public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
 {
     // Repeat this for each var defined in the Values section
     info.AddValue("ConeUnlocked", (ConeUnlocked));
     info.AddValue("HiScore", HiScore);
     info.AddValue("ExplosivesLeft", ExplosivesLeft);
 }
开发者ID:ThomasPlayHaven,项目名称:LaunchProject,代码行数:8,代码来源:FileManager.cs


示例9: GetObjectData

	// Serialization funciton.
	public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
	{
		// You can use any name/value pair, as long as you read them with the same names
		
		info.AddValue("Health", health);
		info.AddValue("Name", name);
	}
开发者ID:vsanchez1987,项目名称:team-ragnarok,代码行数:8,代码来源:Saving.cs


示例10: CChair_SALContainer

 //Serializatoin counstructor. call when Deserialize function called.
 private CChair_SALContainer(SerializationInfo info, StreamingContext context)
     : base(info,context)
 {
     var1 = info.GetInt32("var1");
     var2 = info.GetInt32("var2");
     str1 = (string[])info.GetValue("str1",typeof(string[]));
 }
开发者ID:AidinMolavy,项目名称:GrayMan-Prototype,代码行数:8,代码来源:CChair_SALContainer.cs


示例11: SampledStroke

 public SampledStroke(SerializationInfo info, StreamingContext ctxt)
 {
     beginning = info.GetInt32("beginning");
     str = (List<Dot>)info.GetValue("str", typeof(List<Dot>));
     positionX = 0;
     positionY = 0;
 }
开发者ID:TheAaltoWindrawTeam,项目名称:AaltoWindraw,代码行数:7,代码来源:SampledStroke.cs


示例12: GetObjectData

 public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
 {
     info.AddValue("object2PropertiesMappings", this.object2PropertiesMappings);
     info.AddValue("EZR_VERSION", EZR_VERSION);
     info.AddValue("recordingInterval", this.recordingInterval);
     //base.GetObjectData(info, context);
 }
开发者ID:ChubbRck,项目名称:SFB,代码行数:7,代码来源:Object2PropertiesMappingListWrapper.cs


示例13: GetObjectData

 // Method called to serialize a Vector3 object
 public void GetObjectData(System.Object obj, SerializationInfo info, StreamingContext context)
 {
     Color c = (Color) obj;
     info.AddValue("r", c.r);
     info.AddValue("g", c.g);
     info.AddValue("b", c.b);
 }
开发者ID:elborio,项目名称:SeriousGamingGame,代码行数:8,代码来源:ColorSerializationSurrogate.cs


示例14: PSArgumentException

 /// <summary>
 /// Initializes a new instance of the PSArgumentException class
 /// using data serialized via
 /// <see cref="System.Runtime.Serialization.ISerializable"/>
 /// </summary>
 /// <param name="info"> serialization information </param>
 /// <param name="context"> streaming context </param>
 /// <returns> constructed object </returns>
 protected PSArgumentException(SerializationInfo info,
                    StreamingContext context)
         : base(info, context)
 {
     _errorId = info.GetString("ErrorId");
     _message = info.GetString("PSArgumentException_MessageOverride");
 }
开发者ID:40a,项目名称:PowerShell,代码行数:15,代码来源:MshArgumentException.cs


示例15: GetObjectData

 // Required by the ISerializable class to be properly serialized. This is called automatically
 public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
 {
     // Repeat this for each var defined in the Values section
     info.AddValue("foundGem1", (foundGem1));
     info.AddValue("score", score);
     info.AddValue("levelReached", levelReached);
 }
开发者ID:phpdiva,项目名称:Synergy-repo,代码行数:8,代码来源:SaveData.cs


示例16: GetObjectData

 // Required by the ISerializable class to be properly serialized. This is called automatically
 public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
 {
     // Repeat this for each var defined in the Values section
     info.AddValue("boardWidth", (boardWidth));
     info.AddValue("boardHeight", boardHeight);
     info.AddValue("tiles", tiles);
 }
开发者ID:ragnarok089,项目名称:CS451,代码行数:8,代码来源:SaveData.cs


示例17: GetObjectData

 public void GetObjectData(System.Object obj, SerializationInfo info, StreamingContext context)
 {
     Vector3 v3 = (Vector3)obj;
     info.AddValue("x", v3.x);
     info.AddValue("y", v3.y);
     info.AddValue("z", v3.z);
 }
开发者ID:craus,项目名称:UnityTest,代码行数:7,代码来源:Vector3SerializationSurrogate.cs


示例18: ProfileSaveData

 public ProfileSaveData(SerializationInfo aInfo, StreamingContext aContext)
     : base()
 {
     m_Name = (string)aInfo.GetValue("Name", typeof(string));
     m_ProfileName = (string)aInfo.GetValue("ProfileName", typeof(string));
     m_ProgressionLevel = (int)aInfo.GetValue("ProgressionLevel", typeof(int));
 }
开发者ID:Endevrie,项目名称:Verdant_Story,代码行数:7,代码来源:ProfileSaveData.cs


示例19: p4HelperConfig

	protected p4HelperConfig(SerializationInfo info, StreamingContext context) {
		string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
		if ((strSchema != null)) {
			DataSet ds = new DataSet();
			ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
			if ((ds.Tables["skipDirs"] != null)) {
				this.Tables.Add(new skipDirsDataTable(ds.Tables["skipDirs"]));
			}
			if ((ds.Tables["dir"] != null)) {
				this.Tables.Add(new dirDataTable(ds.Tables["dir"]));
			}
			if ((ds.Tables["skipNameParts"] != null)) {
				this.Tables.Add(new skipNamePartsDataTable(ds.Tables["skipNameParts"]));
			}
			if ((ds.Tables["part"] != null)) {
				this.Tables.Add(new partDataTable(ds.Tables["part"]));
			}
			this.DataSetName = ds.DataSetName;
			this.Prefix = ds.Prefix;
			this.Namespace = ds.Namespace;
			this.Locale = ds.Locale;
			this.CaseSensitive = ds.CaseSensitive;
			this.EnforceConstraints = ds.EnforceConstraints;
			this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
			this.InitVars();
		}
		else {
			this.InitClass();
		}
		this.GetSerializationData(info, context);
		System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
		this.Tables.CollectionChanged += schemaChangedHandler;
		this.Relations.CollectionChanged += schemaChangedHandler;
	}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:34,代码来源:p4helperConfig.cs


示例20: User

 public User(SerializationInfo info, StreamingContext ctxt)
 {
     this.id = (int)info.GetValue("id", typeof(int));
     this.loginname = (string)info.GetValue("loginname", typeof(string));
     this.password = (string)info.GetValue("password", typeof(string));
     this.name = (string)info.GetValue("name", typeof(string));
 }
开发者ID:davidbedok,项目名称:oeprog3,代码行数:7,代码来源:User.cs



注:本文中的SerializationInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SerializationMode类代码示例发布时间:2022-05-24
下一篇:
C# SerializationFormat类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap