Exemple #1
0
 /// <summary>
 /// Gets the named thread context stack
 /// </summary>
 /// <value>
 /// The named stack
 /// </value>
 /// <remarks>
 /// <para>
 /// Gets the named thread context stack
 /// </para>
 /// </remarks>
 public ThreadContextStack this[string key]
 {
     get
     {
         ThreadContextStack threadContextStack = null;
         object             obj = m_properties[key];
         if (obj == null)
         {
             threadContextStack = new ThreadContextStack();
             m_properties[key]  = threadContextStack;
         }
         else
         {
             threadContextStack = (obj as ThreadContextStack);
             if (threadContextStack == null)
             {
                 string text = SystemInfo.NullText;
                 try
                 {
                     text = obj.ToString();
                 }
                 catch
                 {
                 }
                 LogLog.Error(declaringType, "ThreadContextStacks: Request for stack named [" + key + "] failed because a property with the same name exists which is a [" + obj.GetType().Name + "] with value [" + text + "]");
                 threadContextStack = new ThreadContextStack();
             }
         }
         return(threadContextStack);
     }
 }
Exemple #2
0
 public ThreadContextStack this[string key]
 {
     get
     {
         ThreadContextStack stack = null;
         object             obj2  = this.m_properties[key];
         if (obj2 == null)
         {
             stack = new ThreadContextStack();
             this.m_properties[key] = stack;
         }
         else
         {
             stack = obj2 as ThreadContextStack;
             if (stack == null)
             {
                 string nullText = SystemInfo.NullText;
                 try
                 {
                     nullText = obj2.ToString();
                 }
                 catch
                 {
                 }
                 string[] textArray1 = new string[] { "ThreadContextStacks: Request for stack named [", key, "] failed because a property with the same name exists which is a [", obj2.GetType().Name, "] with value [", nullText, "]" };
                 LogLog.Error(declaringType, string.Concat(textArray1));
                 stack = new ThreadContextStack();
             }
         }
         return(stack);
     }
 }
        /// <summary>
        /// Gets the named thread context stack
        /// </summary>
        /// <value>
        /// The named stack
        /// </value>
        /// <remarks>
        /// <para>
        /// Gets the named thread context stack
        /// </para>
        /// </remarks>
        public ThreadContextStack this[string key]
        {
            get
            {
                ThreadContextStack stack = null;

                var propertyValue = m_properties[key];
                if (propertyValue == null)
                {
                    // Stack does not exist, create
                    stack = new ThreadContextStack();
                    m_properties[key] = stack;
                }
                else
                {
                    // Look for existing stack
                    stack = propertyValue as ThreadContextStack;
                    if (stack == null)
                    {
                        // Property is not set to a stack!
                        var propertyValueString = SystemInfo.NullText;

                        try
                        {
                            propertyValueString = propertyValue.ToString();
                        }
                        catch
                        {
                        }

                        LogLog.Error("ThreadContextStacks: Request for stack named [" + key +
                                     "] failed because a property with the same name exists which is a [" +
                                     propertyValue.GetType().Name + "] with value [" + propertyValueString + "]");

                        stack = new ThreadContextStack();
                    }
                }

                return stack;
            }
        }
        /// <summary>
        /// Gets the named thread context stack
        /// </summary>
        /// <value>
        /// The named stack
        /// </value>
        /// <remarks>
        /// <para>
        /// Gets the named thread context stack
        /// </para>
        /// </remarks>
        public ThreadContextStack this[string key]
        {
            get
            {
                ThreadContextStack stack = null;

                var propertyValue = m_properties[key];
                if (propertyValue == null)
                {
                    // Stack does not exist, create
                    stack             = new ThreadContextStack();
                    m_properties[key] = stack;
                }
                else
                {
                    // Look for existing stack
                    stack = propertyValue as ThreadContextStack;
                    if (stack == null)
                    {
                        // Property is not set to a stack!
                        var propertyValueString = SystemInfo.NullText;

                        try
                        {
                            propertyValueString = propertyValue.ToString();
                        }
                        catch
                        {
                        }

                        LogLog.Error("ThreadContextStacks: Request for stack named [" + key +
                                     "] failed because a property with the same name exists which is a [" +
                                     propertyValue.GetType().Name + "] with value [" + propertyValueString + "]");

                        stack = new ThreadContextStack();
                    }
                }

                return(stack);
            }
        }