static Apis() { lock (_initLock) { var asm = MethodInfo.GetCurrentMethod().DeclaringType.Assembly; var types = asm.GetTypes().Where(t => t.HasAttr <ApiAttribute>()).ToHashSet(); Ifaces = types.Where(t => t.IsInterface).ToHashSet(); Statics = types.Where(t => t.IsStatic()).ToHashSet(); (types.Count() == Ifaces.Count() + Statics.Count()).AssertTrue(); Main = Ifaces.SelectMany(t => t.GetMethods(BF.All)).Cast <MethodBase>().ToHashSet(); Mirrors = Ifaces.SelectMany(t => t.GetMethods(BF.All)).Cast <MethodBase>().ToHashSet(); } }
public static bool IsMainApi(this Type t) { return(Ifaces.Contains(t)); }