internal void BuildMDTables()
{
// Check ordering of specific tables
// Constant, CustomAttribute, FieldMarshal, DeclSecurity, MethodSemantics
// ImplMap, NestedClass, GenericParam
// Need to load GenericParamConstraint AFTER GenericParam table in correct order
// The tables:
// InterfaceImpl, ClassLayout, FieldLayout, MethodImpl, FieldRVA
// will _ALWAYS_ be in the correct order as embedded in BuildMDTables
SortTable(tables[(int)MDTable.Constant]);
SortTable(tables[(int)MDTable.CustomAttribute]);
SortTable(tables[(int)MDTable.FieldMarshal]);
SortTable(tables[(int)MDTable.DeclSecurity]);
SortTable(tables[(int)MDTable.MethodSemantics]);
SortTable(tables[(int)MDTable.ImplMap]);
SortTable(tables[(int)MDTable.NestedClass]);
if (tables[(int)MDTable.GenericParam] != null) {
SortTable(tables[(int)MDTable.GenericParam]);
// Now add GenericParamConstraints
for (int i=0; i < tables[(int)MDTable.GenericParam].Count; i++) {
((GenericParam)tables[(int)MDTable.GenericParam][i]).AddConstraints(this);
}
}
/*
// for bug in Whidbey GenericParam table ordering
int end = tables[(int)MDTable.TypeDef].Count;
int methEnd = 0;
if (tables[(int)MDTable.Method] != null) {
methEnd = tables[(int)MDTable.Method].Count;
}
for (int i=0; i < end; i++) {
((ClassDef)tables[(int)MDTable.TypeDef][i]).AddGenericsToTable(this);
if (methEnd > i)
((MethodDef)tables[(int)MDTable.Method][i]).AddGenericsToTable(this);
}
for (int i=end; i < methEnd; i++) {
((MethodDef)tables[(int)MDTable.Method][i]).AddGenericsToTable(this);
}
// end of bug fix
*/
for (int i=0; i < tables.Length; i++) {
if (tables[i] != null) {
for (int j=0; j < tables[i].Count; j++) {
((MetaDataElement)tables[i][j]).BuildSignatures(this);
}
}
}
}