You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
925 B
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

namespace DS.Module.Nuget
{
public class Class1
{
public void test()
{
int? x = null;
//// 使用传统的 if 语句来检查值是否为 null
//if (x == null) {
// // ...
//}
//// 使用模式匹配来检查值是否为 null
//private match(x)
// {
// null =>1 // ...
// value => // ...
// }
// 使用传统的 if 语句来检查值是否为 null
//int? x = null;
//if (x != null)
//{
// // ...
//}
//// 使用 null 传播来检查值是否为 null
//int y = x ?? 0; // 如果 x 为 null则 y 将为 0
///直接抛出空异常 如果数据为空
ArgumentNullException.ThrowIfNull("");
}
}
}