Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posts/return-nullable-generic-in-csharp/ #17

Open
utterances-bot opened this issue Aug 4, 2023 · 1 comment
Open

posts/return-nullable-generic-in-csharp/ #17

utterances-bot opened this issue Aug 4, 2023 · 1 comment

Comments

@utterances-bot
Copy link

C#中的可为空泛型返回值 | fissssssh

当在 C# 8.0 中启用 NRT(Nullable Reference Types)时,代码中的 null 引用检查会得到加强,以帮助开发人员更好地识别和处理可能的空引用异常。在这种情况下,使用 T? 表示可空类型,其中 T 可以是引用类型或值类型。但是,如果使用 where T : struct 限定类型参数 T 为值类型,则 T? 表示 Nullable。
var a = GetA(); var b = GetB

https://fissssssh.aiursoft.cn/posts/return-nullable-generic-in-csharp/

Copy link

Kit086 commented Aug 4, 2023

投奔 Optional 模式吧🐸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants