public static void RegisterInstance <T>(IGenericArithmetic <T> math) { math.AssertNotNull(nameof(math)); if (_implementations.ContainsKey(typeof(T))) { throw new InvalidOperationException($"Implementation of {typeof(IGenericArithmetic<T>)} already registered."); } _implementations.Add(typeof(T), math); }