示例#1
0
        private void InitKnownNames()
        {
            if (s_knownNames == null)
            {
                NameTable tmp = new NameTable();

                // add all predefined names
                Debug.Assert(s_predefinedNames.Length == (int)PredefinedName.PN_COUNT);
                for (int i = 0, n = s_predefinedNames.Length; i < n; i++)
                {
                    Debug.Assert((int)s_predefinedNames[i].PredefinedName == i);
                    Name name = s_predefinedNames[i];
                    tmp.Add(name);
                }

                // add all other names
                foreach (KnownName name in s_otherNames)
                {
                    tmp.Add(name);
                }

                Interlocked.CompareExchange<NameTable>(ref s_knownNames, tmp, null);
            }
        }