Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

使用Nullable在编译时消除null #210

Open
frg2089 opened this issue May 31, 2023 · 2 comments
Open

使用Nullable在编译时消除null #210

frg2089 opened this issue May 31, 2023 · 2 comments

Comments

@frg2089
Copy link

frg2089 commented May 31, 2023

项目中有太多Null了,在项目文件中添加这条语句使编译器对可能为null的值发出警告

<Nullable>enable</Nullable>

<PropertyGroup>
<LangVersion>latest</LangVersion>
<!-- <Nullable>enable</Nullable> -->
<TargetFrameworks>netstandard2.1;net60;net70</TargetFrameworks>
<TargetArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</TargetArchitecture>
</PropertyGroup>

https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/nullable-value-types

@frg2089
Copy link
Author

frg2089 commented May 31, 2023

欸...我才注意到 为什么被注释掉了...?

@TheSnowfield
Copy link
Member

欸...我才注意到 为什么被注释掉了...?

在計畫之中。但是目前工作量太大,所以先暫時注釋

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

No branches or pull requests

2 participants