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

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

Description

@frg2089

项目中有太多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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions