55

C#中 object类型的参数遇到重载该如何写得优雅?

 6 years ago
source link: http://gad.qq.com/question/detail/42389
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
大致就是有一个object类型的参数,在调用时遇到重载,目前只能根据类型直接进行强制转换,代码看起来很坑爹:void text(object obj){    if(obj is int){        func((int)obj);&n...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK