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

C# Serialization.SerializationInfo类代码示例

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

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



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

示例1: UserClient

 //deserialize method
 public UserClient(SerializationInfo info, StreamingContext ctxt)
 {
     username = (string)info.GetValue("username", typeof(string));
     password = (string)info.GetValue("password", typeof(string));
     try
     {
         isOnline = (bool)info.GetValue("isOnline", typeof(bool));
     }
     catch(Exception e )
     {
         isOnline = false;
     }
     try {
         physician = (string)info.GetValue("physician", typeof(string));
     }
     catch(Exception e)
     {
         physician = "jaap";
     }
     try {
         sessions = (List<Session>)info.GetValue("sessions", typeof(List<Session>));
     }
     catch(Exception e)
     {
        sessions = new List<Session>();
     }
     try
     {
         tests = (List<Session>)info.GetValue("tests", typeof(List<Session>));
     }
     catch(Exception e) {
         tests = new List<Session>();
     }
 }
开发者ID:xrgman,项目名称:CycleMasterPro2000,代码行数:35,代码来源:UserClient.cs


示例2: SoapFault

        internal SoapFault(SerializationInfo info, StreamingContext context)
        {
            SerializationInfoEnumerator siEnum = info.GetEnumerator();        

            while(siEnum.MoveNext())
            {
                String name = siEnum.Name;
                Object value = siEnum.Value;
                SerTrace.Log(this, "SetObjectData enum ",name," value ",value);
                if (String.Compare(name, "faultCode", true, CultureInfo.InvariantCulture) == 0)
                {
                    int index = ((String)value).IndexOf(':');
                    if (index > -1)
                        faultCode = ((String)value).Substring(++index);
                    else
                        faultCode = (String)value;
                }
                else if (String.Compare(name, "faultString", true, CultureInfo.InvariantCulture) == 0)
                    faultString = (String)value;
                else if (String.Compare(name, "faultActor", true, CultureInfo.InvariantCulture) == 0)
                    faultActor = (String)value;
                else if (String.Compare(name, "detail", true, CultureInfo.InvariantCulture) == 0)
                    detail = value;
            }
        }
开发者ID:destinyclown,项目名称:coreclr,代码行数:25,代码来源:SoapFault.cs


示例3: SO_NWS_Highlight

		public SO_NWS_Highlight(
			SerializationInfo info_in,
			StreamingContext context_in
		) {
			haschanges_ = false;

			idhighlight_ = (long)info_in.GetValue("IDHighlight", typeof(long));
			ifapplication_ 
				= (info_in.GetValue("IFApplication", typeof(int)) == null)
					? 0
					: (int)info_in.GetValue("IFApplication", typeof(int));
			IFApplication_isNull = (bool)info_in.GetValue("IFApplication_isNull", typeof(bool));
			ifhighlight__parent_ 
				= (info_in.GetValue("IFHighlight__parent", typeof(long)) == null)
					? 0L
					: (long)info_in.GetValue("IFHighlight__parent", typeof(long));
			IFHighlight__parent_isNull = (bool)info_in.GetValue("IFHighlight__parent_isNull", typeof(bool));
			name_ = (string)info_in.GetValue("Name", typeof(string));
			ifuser__approved_ 
				= (info_in.GetValue("IFUser__Approved", typeof(long)) == null)
					? 0L
					: (long)info_in.GetValue("IFUser__Approved", typeof(long));
			IFUser__Approved_isNull = (bool)info_in.GetValue("IFUser__Approved_isNull", typeof(bool));
			approved_date_ 
				= (info_in.GetValue("Approved_date", typeof(DateTime)) == null)
					? new DateTime(1900, 1, 1)
					: (DateTime)info_in.GetValue("Approved_date", typeof(DateTime));
			Approved_date_isNull = (bool)info_in.GetValue("Approved_date_isNull", typeof(bool));
		}
开发者ID:BackupTheBerlios,项目名称:ogen-svn,代码行数:29,代码来源:SO0_NWS_Highlight.cs


示例4: UpdateException

        protected UpdateException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            this.Errors = (IList<UpdateError>)info.GetValue(ERRORSKEY, typeof(IList<UpdateError>));

            this.ErrorDetail = info.GetString(ERRORDETAILKEY);
        }
开发者ID:RecordLion,项目名称:information-lifecycle-sdk,代码行数:7,代码来源:UpdateException.cs


示例5: GetObjectData

 public void GetObjectData(object obj, SerializationInfo info, StreamingContext context) {
     var color = (Color)obj;
     info.AddValue("r", color.r);
     info.AddValue("g", color.g);
     info.AddValue("b", color.b);
     info.AddValue("a", color.a);
 }
开发者ID:Boxxxx,项目名称:clicker,代码行数:7,代码来源:ColorSurrogate.cs


示例6: Restore

        public object Restore()
        {
            var type = Type.GetType(assemblyQualifiedName);

            var ctor = type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new [] {
                typeof(SerializationInfo),
                typeof(StreamingContext)
            }, null);

            var serializationInfo = new SerializationInfo(type, new FormatterConverter());
            serializationInfo.SetType(type);
            for(var i = 0; i < keys.Length; i++)
            {
                serializationInfo.AddValue(keys[i], values[i]);
            }
            var streamingContext = new StreamingContext(StreamingContextStates.Clone);
            var result = ctor.Invoke(new object[] { serializationInfo, streamingContext });
            var onDeserialization = result as IDeserializationCallback;
            if(onDeserialization != null)
            {
                onDeserialization.OnDeserialization(this);
            }

            return result;
        }
开发者ID:rogeralsing,项目名称:Migrant,代码行数:25,代码来源:SurrogateForISerializable.cs


示例7: DatasetPatrols

 protected DatasetPatrols(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["Patrols"] != null)) {
             this.Tables.Add(new PatrolsDataTable(ds.Tables["Patrols"]));
         }
         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:WinShooter,项目名称:WinShooter-Legacy,代码行数:25,代码来源:DatasetPatrols.cs


示例8: Deserialize

		protected override void Deserialize (SerializationInfo info, StreamingContext context)
		{
			text = (string) info.GetValue ("AssemblyName", typeof (AssemblyName));
			base.Filter = (ICollection)info.GetValue ("Filter", typeof (ICollection));
			base.DisplayName = info.GetString ("DisplayName");
			if (info.GetBoolean ("Locked")) base.Lock ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:TextToolboxItem.cs


示例9: EncoderNLS

 // Constructor called by serialization. called during deserialization.
 internal EncoderNLS(SerializationInfo info, StreamingContext context)
 {
     throw new NotSupportedException(
                 String.Format(
                     System.Globalization.CultureInfo.CurrentCulture, 
                     Environment.GetResourceString("NotSupported_TypeCannotDeserialized"), this.GetType()));
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:8,代码来源:EncoderNLS.cs


示例10: CaseInsensitiveHashtable

 /// <summary>
 ///     Initializes a new, empty instance of the <see cref="T:System.Collections.Hashtable"></see> class that is
 ///     serializable using the specified <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> and
 ///     <see cref="T:System.Runtime.Serialization.StreamingContext"></see> objects.
 /// </summary>
 /// <param name="context">
 ///     A <see cref="T:System.Runtime.Serialization.StreamingContext"></see> object containing the source
 ///     and destination of the serialized stream associated with the <see cref="T:System.Collections.Hashtable"></see>.
 /// </param>
 /// <param name="info">
 ///     A <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> object containing the
 ///     information required to serialize the <see cref="T:System.Collections.Hashtable"></see> object.
 /// </param>
 /// <exception cref="T:System.ArgumentNullException">info is null. </exception>
 protected CaseInsensitiveHashtable(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     var cultureName = info.GetString("_cultureName");
     _culture = new CultureInfo(cultureName);
     AssertUtils.ArgumentNotNull(_culture, "Culture");
 }
开发者ID:kog,项目名称:Solenoid-Expressions,代码行数:21,代码来源:CaseInsensitiveHashtable.cs


示例11: XmlException

        protected XmlException(SerializationInfo info, StreamingContext context) : base(info, context) {
            res                 = (string)  info.GetValue("res"  , typeof(string));
            args                = (string[])info.GetValue("args", typeof(string[]));
            lineNumber          = (int)     info.GetValue("lineNumber", typeof(int));
            linePosition        = (int)     info.GetValue("linePosition", typeof(int));

            // deserialize optional members
            sourceUri = string.Empty;
            string version = null;
            foreach ( SerializationEntry e in info ) {
                switch ( e.Name ) {
                    case "sourceUri":
                        sourceUri = (string)e.Value;
                        break;
                    case "version":
                        version = (string)e.Value;
                        break;
                }
            }

            if ( version == null ) {
                // deserializing V1 exception
                message = CreateMessage( res, args, lineNumber, linePosition );
            }
            else {
                // deserializing V2 or higher exception -> exception message is serialized by the base class (Exception._message)
                message = null;
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:XmlException.cs


示例12: Tile

        public Tile(SerializationInfo info, StreamingContext ctx)
            : base(info, ctx)
        {
            m_strName = null;
            try {
                m_strName = info.GetString("Name");
            } catch {
                m_strName = info.GetInt32("Cookie").ToString();
            }

            m_afVisible = (bool[,])info.GetValue("Visibility", typeof(bool[,]));

            try {
                m_afOccupancy = (bool[,])info.GetValue("Occupancy", typeof(bool[,]));
            } catch {
                TemplateDoc tmpd = (TemplateDoc)DocManager.GetActiveDocument(typeof(TemplateDoc));
                Template tmpl = tmpd.FindTemplate(m_strName);
                if (tmpl != null) {
                    m_afOccupancy = tmpl.OccupancyMap;
                } else {
                    m_afOccupancy = new bool[1, 1];
                }
            }

            InitCommon();
        }
开发者ID:RusselRains,项目名称:hostile-takeover,代码行数:26,代码来源:tile.cs


示例13: GetObjectData

 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue(nameof(Name), Name);
     info.AddValue(nameof(ProviderName), ProviderName);
     info.AddValue(nameof(ProviderParameters), ProviderParameters);
     info.AddValue(nameof(VaultParameters), VaultParameters);
 }
开发者ID:bseddon,项目名称:ACMESharp,代码行数:7,代码来源:VaultProfileManager.cs


示例14: GetObjectData

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            info.AddValue("DataServiceException.FaultMessage", Fault.Message);
            info.AddValue("DataServiceException.FaultMessage", Fault.Detail);
        }
开发者ID:gobixm,项目名称:learn,代码行数:7,代码来源:DataServiceException.cs


示例15: GetObjectData

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("ClipboardOwnerProcessName", processName);
            info.AddValue("ClipboardOwnerProcessId", processId);

            base.GetObjectData(info, context);
        }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:ClipboardException.cs


示例16: SerializeEncoder

 // ISerializable implementation. called during serialization.
 void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
 {
     SerializeEncoder(info);
     info.AddValue("encoding", this.m_encoding);
     info.AddValue("charLeftOver", this.charLeftOver);
     info.SetType(typeof(Encoding.DefaultEncoder));
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:8,代码来源:EncoderNLS.cs


示例17: DocumentException

 protected DocumentException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     Line = info.GetInt32(nameof(Line));
     Column = info.GetInt32(nameof(Column));
     File = info.GetString(nameof(File));
 }
开发者ID:dotnet,项目名称:docfx,代码行数:7,代码来源:DocumentException.cs


示例18: GetObjectData

 /// <summary>
 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object.
 /// </summary>
 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param>
 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param>
 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     if(Tracing.BinarySerializationSwitch.Enabled)
         Trace.WriteLine("Serializing the fields of 'SwitchIconMaterial'.");
     base.GetObjectData(info, context);
     info.AddValue("SwitchType", this.mSwitchType.ToString());
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:13,代码来源:SwitchIconMaterial.Serialization.cs


示例19: Lookup

        /// <exclude/>
        public Lookup(SerializationInfo serializationInfo, StreamingContext streamingContext)
        {
            int version = 0;

            if (SerializationVersionExists)
            {
                try
                {
                    version = serializationInfo.GetInt32("SerializationVersion");
                }
                catch (SerializationException)
                {
                    // ignore
                    SerializationVersionExists = false;
                }
            }
            _alias = serializationInfo.GetString("Alias");
            _aliasPlural = serializationInfo.GetString("AliasPlural");
            _enabled = serializationInfo.GetBoolean("Enabled");
            _isUserDefined = serializationInfo.GetBoolean("IsUserDefined");
            _name = serializationInfo.GetString("Name");
            _userOptions = (List<IUserOption>)serializationInfo.GetValue("UserOptions", ModelTypes.UserOptionList);
            _description = serializationInfo.GetString("Description");
            _backingObject = (ScriptObject)serializationInfo.GetValue("BackingObject", ModelTypes.ScriptObject);
            _idColumn = (Column)serializationInfo.GetValue("IdColumn", ModelTypes.Column);
            _nameColumn = (Column)serializationInfo.GetValue("NameColumn", ModelTypes.Column);
            _LookupValues = (List<LookupValue>)serializationInfo.GetValue("LookupValues", ModelTypes.LookupValueList);
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:29,代码来源:Lookup.cs


示例20: GetObjectData

 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     if (info == null)
     {
         throw new ArgumentNullException(nameof(info));
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:CompressedStack.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.StreamingContext类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.ObjectManager类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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