System.Text.RegularExpressions.RegexTypeCompiler.GenerateCreateHashtable C# (CSharp) Method

GenerateCreateHashtable() private method

private GenerateCreateHashtable ( FieldInfo field, Hashtable ht ) : void
field System.Reflection.FieldInfo
ht System.Collections.Hashtable
return void
        internal void GenerateCreateHashtable(FieldInfo field, Hashtable ht) {
            MethodInfo addMethod = typeof(Hashtable).GetMethod("Add", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
            
            Ldthis();
            Newobj(typeof(Hashtable).GetConstructor(new Type[0]));
            Stfld(field);
        
            IDictionaryEnumerator en = ht.GetEnumerator();
            while (en.MoveNext()) {
                Ldthisfld(field);
        
                if (en.Key is int) {
                    Ldc((int) en.Key);  
                    _ilg.Emit(OpCodes.Box, typeof(Int32));
                }
                else 
                    Ldstr((String) en.Key);
        
                Ldc((int) en.Value);    
                _ilg.Emit(OpCodes.Box, typeof(Int32));
                Callvirt(addMethod);
            }
        }