Microsoft.Scripting.ScopeVariable.TryGetValue C# (CSharp) Method

TryGetValue() public method

Atempts to get the value. If a value is assigned it returns true otherwise it returns false.
public TryGetValue ( Object &value ) : bool
value System.Object
return bool
        public bool TryGetValue(out dynamic value) {
            value = _value;
            if ((object)value != _novalue) {
                return true;
            }
            value = null;
            return false;
        }

Usage Example

Example #1
0
        /// <summary>
        /// Atempts to get the value. If a value is assigned it returns true otherwise
        /// it returns false.
        /// </summary>
        public bool TryGetValue(out dynamic value)
        {
            object objValue;

            if (_firstVariable.TryGetValue(out objValue))
            {
                value = objValue;
                return(true);
            }
            if (_overflow != null)
            {
                lock (_overflow) {
                    foreach (var entry in _overflow)
                    {
                        if (entry.Value.TryGetValue(out objValue))
                        {
                            value = objValue;
                            return(true);
                        }
                    }
                }
            }
            value = null;
            return(false);
        }