有型有什么区别?和可空<&型GT ;? [英] Is there any difference between type? and Nullable<type>?

查看:123
本文介绍了有型有什么区别?和可空<&型GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中是可空原始类型(即布尔?)只是别名作为他们相应的可空< T> 类型或是两者之间有区别吗?

In C# are the nullable primitive types (i.e. bool?) just aliases for their corresponding Nullable<T> type or is there a difference between the two?

推荐答案

如果你看看IL使用的 ILDASM ,你会发现,他们都编译到可空&LT;布尔方式&gt;

If you look at the IL using Ildasm, you'll find that they both compile down to Nullable<bool>.

这篇关于有型有什么区别?和可空&LT;&型GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆