示例#1
0
        public ProbeContext CreateScope(string key)
        {
            var scope = new ScopeProbeContext(_cancellationToken);

            IList <ScopeProbeContext> list;

            object value;

            if (_variables.TryGetValue(key, out value))
            {
                list = value as IList <ScopeProbeContext>;
                if (list == null)
                {
                    throw new InvalidOperationException("The key already exists and is not a scope collection: " + key);
                }
            }
            else
            {
                list            = new List <ScopeProbeContext>();
                _variables[key] = list;
            }

            list.Add(scope);
            return(scope);
        }
示例#2
0
        public ProbeContext CreateScope(string key)
        {
            var scope = new ScopeProbeContext(_cancellationToken);

            IList<ScopeProbeContext> list;

            object value;
            if (_variables.TryGetValue(key, out value))
            {
                list = value as IList<ScopeProbeContext>;
                if (list == null)
                    throw new InvalidOperationException("The key already exists and is not a scope collection: " + key);
            }
            else
            {
                list = new List<ScopeProbeContext>();
                _variables[key] = list;
            }

            list.Add(scope);
            return scope;
        }