System.SharedStatics.GetSharedStringMaker C# (CSharp) Method

GetSharedStringMaker() static public method

static public GetSharedStringMaker ( ) : System.Security.Util.Tokenizer.StringMaker
return System.Security.Util.Tokenizer.StringMaker
        static public StringMaker GetSharedStringMaker()
        {
            StringMaker maker = null;
            
            bool tookLock = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                Monitor.ReliableEnter(_sharedStatics, ref tookLock);

                if (_sharedStatics._maker != null)
                {
                    maker = _sharedStatics._maker;
                    _sharedStatics._maker = null;
                }
            }
            finally {
                if (tookLock)
                    Monitor.Exit(_sharedStatics);
            }
            
            if (maker == null)
            {
                maker = new StringMaker();
            }
            
            return maker;
        }