C# 返回值使用范型

最近在做research项目,和高手学了不少东西。。呵呵,分享一下。。 在返回值不确定的情况下使用范型。。
Convert.ChangeType 方法 (Object, Type)

返回具有指定 Type 而且其值等效于指定对象的object。


 

Code

在调用的地方:

this.txtNum1.Value =TestGenerics.GetValue<int>("Num1");
this.txtNum2.Value = TestGenerics.GetValue<int>("Num2");


之后还会努力研究。。多多学习。。
哈哈。。。 激情成就未来。。



posted @ 2009-07-23 23:18  Denny_Guo  阅读(441)  评论(0编辑  收藏  举报