通用类型检查数值

问题描述

我希望能够检查提供的天气类型参数是否来自数字格式。 (double,int,float等),我可以通过以下方式“手动”检查where语句中的内容

class RangeDictionary<TNumericKey,TValue> where TNumericKey is int ||  TNumericKey is double /*etc*/ : Dictionary<TNumericKey,TValue>

但是我想要更多类似的东西:

class RangeDictionary<TNumericKey,TValue> where TNumericKey is INumeric : Dictionary<TNumericKey,TValue>

有可能吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)