Let the storm money come!

.net 转换任意类型不报错

代码
public T CastAll<T>(object value)
        {
            T temp 
= default(T);
            
try
            {
                temp 
= (T)value;
            }
            
catch
            {
                temp 
= default(T);
            }
          
            
return (T)temp;
        }

 

posted @ 2010-04-10 23:39  精密~顽石  阅读(188)  评论(0编辑  收藏  举报
在通往地狱的路上,加班能使你更快到达。