Ejemplo n.º 1
0
        /// <summary>Gets a variable's definition.</summary>
        /// <param name="source">The source.</param>
        /// <param name="name">The variable name.</param>
        /// <returns>The variable.</returns>
        /// <exception cref="KeyNotFoundException">The variable does not exist.</exception>
        /// <exception cref="Exception">An error occurred getting the variable.</exception>
        /// <remarks>
        /// The variable is locked for reading while the value is read.
        /// </remarks>
        public static Variable GetInfo(this VariableDispenser source, string name)
        {
            var variable = source.TryGetInfo(name);

            if (variable != null)
            {
                return(variable);
            }

            throw new KeyNotFoundException("Variable not found.");
        }