C# 返回值使用范型
最近在做research项目,和高手学了不少东西。。呵呵,分享一下。。 在返回值不确定的情况下使用范型。。
Convert.ChangeType 方法 (Object, Type)
返回具有指定 Type 而且其值等效于指定对象的object。
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
在调用的地方:
this.txtNum1.Value =TestGenerics.GetValue<int>("Num1");
this.txtNum2.Value = TestGenerics.GetValue<int>("Num2");
this.txtNum2.Value = TestGenerics.GetValue<int>("Num2");
之后还会努力研究。。多多学习。。
哈哈。。。 激情成就未来。。