问题描述
可能重复:结果
的
所以,我已经看到了一些代码周围,他们几个人用?之后的类型,像这样的:
So I've seen some code around and a few of them use a ? after the type, like this:
private Point? loc = null;
所以我想知道如果点?比不同点(不能把一个问号在我的句末,不然我就搞不清你们...:])。我使用的语言是C#的方式。
So I'm wondering if Point? is different than Point (can't put a question mark at the end of my sentence or I'll confuse you guys ... :] ). The language I'm using is C# by the way.
推荐答案
T?
是可空℃的简写(在C#); T>
- 这样点
是写作的另一种方式可空<点> 或例如
T?
is a shorthand (in C#) for Nullable<T>
- so Point?
is another way of writing Nullable<Point>
or example.
请参阅节1.3和C#3语言规范4.1 - 和其他各种场所,说实话 - 了解更多详情。请参阅从事物的框架侧的更多信息。或读取深度C#第4章:)(可惜这不是免费的章节之一。)
See sections 1.3 and 4.1 of the C# 3 language spec - and various other places, to be honest - for more details. See the docs for System.Nullable<T>
for more information from the framework side of things. Or read chapter 4 of C# in Depth :) (Unfortunately it's not one of the free chapters.)
(这个问题注定是重复的,但我不'吨有能量,现在找到它。)
(This question is bound to be a duplicate, but I don't have the energy to find it right now.)
这篇关于什么的?一个类型之后是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!