YAMP.ParseContext.GetVariableContext C# (CSharp) Method

GetVariableContext() public method

Gets the exact context of the given variable.
public GetVariableContext ( String name ) : ParseContext
name String The name of the variable.
return ParseContext
        public ParseContext GetVariableContext(String name)
        {
            if (_variables.ContainsKey(name))
            {
                return this;
            }

            if (_parent != null)
            {
                return _parent.GetVariableContext(name);
            }

            return null;
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Gets the exact context of the given variable.
        /// </summary>
        /// <param name="name">The name of the variable.</param>
        /// <returns>The context or NULL if nothing was found.</returns>
        public ParseContext GetVariableContext(String name)
        {
            if (_variables.ContainsKey(name))
            {
                return(this);
            }

            if (_parent != null)
            {
                return(_parent.GetVariableContext(name));
            }

            return(null);
        }