// Enumerate all possible virtual slots of a type public static IEnumerable <MethodDesc> EnumAllVirtualSlots(MetadataType type) { MethodDescHashtable alreadyEnumerated = new MethodDescHashtable(); if (!type.IsInterface) { do { foreach (MethodDesc m in type.GetAllMethods()) { if (!m.IsVirtual) { continue; } MethodDesc possibleVirtual = FindSlotDefiningMethodForVirtualMethod(m); if (!alreadyEnumerated.Contains(possibleVirtual)) { alreadyEnumerated.AddOrGetExisting(possibleVirtual); yield return(possibleVirtual); } } type = type.MetadataBaseType; } while (type != null); } }