public static T GetValue<T>(string Key) { T result = default(T);//这个default是先取泛型的默认值 result = (T)Convert.ChangeType(_config[Key], typeof(T));//然后在这里进行强转 return result; }
.net 通过泛型取值
猜你喜欢
转载自www.cnblogs.com/liaojianwang/p/11103881.html
今日推荐
周排行