Automation/Utilities/Scope.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComLib.Automation
{
    /// <summary>
    /// Used to store local variables.
    /// </summary>
    public class Scope 
    {        
        private List<OrderedDictionary> _stack;
        private int _currentStackIndex = 0;


        /// <summary>
        /// Initialize
        /// </summary>
        public Scope()
        {
            _stack = new List<OrderedDictionary>();
            _stack.Add(new OrderedDictionary());
        }


        /// <summary>
        /// Whether or not the scope contains the supplied variable name
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool Contains(string name)
        {
            int stackIndex = Find(name);
            return stackIndex > -1;
        }


        /// <summary>
        /// Get the variable from the current scope.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public object this[string name]
        {
            get
            {
                return Get<object>(name);
            }
        }


        /// <summary>
        /// Get the variable value associated with name from the scope
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name">Name of the varibale to get</param>
        /// <returns></returns>
后面还有 60 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。