Tag: 类型可以为

变量类型以?结尾?

什么 意思: public bool? Verbose { get; set; } 当应用于string? ,有一个错误: 类型’string’必须是非可空值类型才能在generics类型或方法’System.Nullable’中将其用作参数’T’

generics类型参数和Nullable方法重载

你好 我有使用generics和可空的代码: // The first one is for class public static TResult With(this TInput o, Func evaluator) where TResult : class where TInput : class // The second one is for struct (Nullable) public static TResult With(this Nullable o, Func evaluator) where TResult : class where TInput : struct 请注意TInput约束,一个是类,另一个是struct。 然后我用它们: string s; int? i; […]

这是什么? 是什么意思?

可能重复: 一个好奇的c#语法 所以我看到了一些代码,其中一些使用了? 在类型之后,像这样: private Point? loc = null; 所以我想知道Point? 与Point不同(不能在我的句子末尾加上问号或者我会让你们混淆……:])。 我使用的语言就是C#。