public void SetSystemModule(ModuleDesc systemModule) { InitializeSystemModule(systemModule); // Sanity check the name table Debug.Assert(s_wellKnownTypeNames[(int)WellKnownType.MulticastDelegate - 1] == "MulticastDelegate"); // Initialize all well known types - it will save us from checking the name for each loaded type for (int typeIndex = 0; typeIndex < _wellKnownTypes.Length; typeIndex++) { MetadataType type = systemModule.GetType("System", s_wellKnownTypeNames[typeIndex]); type.SetWellKnownType((WellKnownType)(typeIndex + 1)); _wellKnownTypes[typeIndex] = type; } }
public virtual void SetSystemModule(ModuleDesc systemModule) { InitializeSystemModule(systemModule); // Sanity check the name table Debug.Assert(s_wellKnownTypeNames[(int)WellKnownType.MulticastDelegate - 1] == "MulticastDelegate"); _wellKnownTypes = new MetadataType[s_wellKnownTypeNames.Length]; // Initialize all well known types - it will save us from checking the name for each loaded type for (int typeIndex = 0; typeIndex < _wellKnownTypes.Length; typeIndex++) { // Require System.Object to be present as a minimal sanity check. // The set of required well-known types is not strictly defined since different .NET profiles implement different subsets. MetadataType type = systemModule.GetType("System", s_wellKnownTypeNames[typeIndex], typeIndex == (int)WellKnownType.Object); if (type != null) { type.SetWellKnownType((WellKnownType)(typeIndex + 1)); _wellKnownTypes[typeIndex] = type; } } }