using Invercargill.DataStructures; namespace Invercargill { private static Dictionary promotion_registry = null; public static void register_promotion(Type generic, Type promotion) { if(promotion_registry == null) { promotion_registry = new Dictionary(); } promotion_registry[generic] = promotion; } public static void resolve_promotion(ref Type type) { if(promotion_registry == null) { return; } Type promotion; if(promotion_registry.try_get(typeof(T), out promotion)) { type = promotion; } } public interface Promotion { public abstract Enumerable wrap(Enumerable enumerable) throws PromotionError; public abstract bool can_wrap(Type element_type); } }