Exemple #1
0
        /// <summary>Gets a symbol from this pool, if the name exists already.</summary>
        /// <param name="name">Symbol Name to find</param>
        /// <returns>Returns the existing Symbol if found; returns null if the name
        /// was not found, or if the name itself was null.</returns>
        public Symbol GetIfExists(string name)
        {
            Symbol sym;

            if (name == null)
            {
                return(null);
            }
            else
            {
                lock (_map) {
                    _map.TryGetValue(name, out sym);

                    if (_weakMap != null)
                    {
                        if (_weakMap.AutoCleanup())
                        {
                            if (_idMap != null)
                            {
                                ((WeakValueDictionary <int, Symbol>)_idMap).Cleanup();
                            }
                        }
                    }

                    return(sym);
                }
            }
        }