long offset_table_offset = bw.BaseStream.Position;
ot.Write (bw);
+ //
+ // Sort the methods according to their tokens and update their index.
+ //
+ methods.Sort ();
+ for (int i = 0; i < methods.Count; i++)
+ ((MethodEntry) methods [i]).Index = i + 1;
+
//
// Write data sections.
//
ot.DataSectionSize = (int) bw.BaseStream.Position - ot.DataSectionOffset;
//
- // Write out the method index
+ // Write the method index table.
//
ot.MethodTableOffset = (int) bw.BaseStream.Position;
for (int i = 0; i < methods.Count; i++) {