public override void VisitTypeDefinitionCollection(TypeDefinitionCollection types) { // type def reading TypeDefTable typesTable = m_tableReader.GetTypeDefTable(); m_typeDefs = new TypeDefinition [typesTable.Rows.Count]; for (int i = 0; i < typesTable.Rows.Count; i++) { TypeDefRow type = typesTable [i]; TypeDefinition t = new TypeDefinition( m_root.Streams.StringsHeap [type.Name], m_root.Streams.StringsHeap [type.Namespace], type.Flags); t.MetadataToken = MetadataToken.FromMetadataRow(TokenType.TypeDef, i); m_typeDefs [i] = t; } // nested types if (m_tHeap.HasTable(NestedClassTable.RId)) { NestedClassTable nested = m_tableReader.GetNestedClassTable(); for (int i = 0; i < nested.Rows.Count; i++) { NestedClassRow row = nested [i]; TypeDefinition parent = GetTypeDefAt(row.EnclosingClass); TypeDefinition child = GetTypeDefAt(row.NestedClass); parent.NestedTypes.Add(child); } } foreach (TypeDefinition type in m_typeDefs) { types.Add(type); } // type ref reading if (m_tHeap.HasTable(TypeRefTable.RId)) { TypeRefTable typesRef = m_tableReader.GetTypeRefTable(); m_typeRefs = new TypeReference [typesRef.Rows.Count]; for (int i = 0; i < typesRef.Rows.Count; i++) { AddTypeRef(typesRef, i); } } else { m_typeRefs = new TypeReference [0]; } ReadTypeSpecs(); ReadMethodSpecs(); ReadMethods(); ReadGenericParameters(); // set base types for (int i = 0; i < typesTable.Rows.Count; i++) { TypeDefRow type = typesTable [i]; TypeDefinition child = m_typeDefs [i]; child.BaseType = GetTypeDefOrRef(type.Extends, new GenericContext(child)); } CompleteMethods(); ReadAllFields(); ReadMemberReferences(); }