當前位置: 首頁>>代碼示例>>C#>>正文


C# Exception.Store方法代碼示例

本文整理匯總了C#中System.Exception.Store方法的典型用法代碼示例。如果您正苦於以下問題:C# Exception.Store方法的具體用法?C# Exception.Store怎麽用?C# Exception.Store使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Exception的用法示例。


在下文中一共展示了Exception.Store方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: StorePosition

        /// <summary>
        /// Stores debug information about the current state of the reader, into the specified <see cref="Exception"/>.
        /// </summary>
        /// <param name="exception">The exception to store the state of the reader in.</param>
        public virtual void StorePosition( Exception exception )
        {
            // NOTE: we don't throw any exceptions from here, in case this property is used to store as some exception's data
            if( exception.NotNullReference() )
            {
                exception.Store("Token", this.Token);
                exception.Store("Name", this.Name);

                // prevent stack overflow (these properties throw exceptions)
                if( this.Token != DataStoreToken.DataStoreStart
                 || this.Token != DataStoreToken.DataStoreEnd )
                {
                    exception.Store("Depth", this.Depth);
                    exception.Store("Path", this.Path);
                }
            }
        }
開發者ID:MechanicalMen,項目名稱:Mechanical2,代碼行數:21,代碼來源:DataStoreReaderBase.cs

示例2: StorePosition

        /// <summary>
        /// Stores debug information about the current state of the reader, into the specified <see cref="Exception"/>.
        /// </summary>
        /// <param name="exception">The exception to store the state of the reader in.</param>
        public override void StorePosition( Exception exception )
        {
            base.StorePosition(exception);

            var lineInfo = this.xmlReader as IXmlLineInfo;
            if( lineInfo.NotNullReference()
             && lineInfo.HasLineInfo() )
            {
                exception.Store("XmlLine", lineInfo.LineNumber);
                exception.Store("XmlColumn", lineInfo.LinePosition);
            }
        }
開發者ID:MechanicalMen,項目名稱:Mechanical2,代碼行數:16,代碼來源:XmlDataStoreReader.cs

示例3: StorePosition

        /// <summary>
        /// Stores debug information about the current state of the reader, into the specified <see cref="Exception"/>.
        /// </summary>
        /// <param name="exception">The exception to store the state of the reader in.</param>
        public override void StorePosition( Exception exception )
        {
            base.StorePosition(exception);

            try
            {
                exception.Store("JsonLine", this.jsonReader.LineNumber);
                exception.Store("JsonColumn", this.jsonReader.ColumnNumber);
            }
            catch
            {
            }
        }
開發者ID:MechanicalMen,項目名稱:Mechanical2,代碼行數:17,代碼來源:JsonDataStoreReader.cs


注:本文中的System.Exception.Store方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。