Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
可空引用类型意外 CS8629 可空值类型对于临时变量可能为空
在 C 8 项目中 我使用可为 null 的引用类型 并收到意外的 或者至少对我来说意外的 CS8629 警告 bool singleContent x DataInt null bool multiContent x DataNvarch
c
C80
nullablereferencetypes
多维数组、可为 null 的引用类型和类型转换
使用 C 8 的可空引用类型 我们可以编写 对于引用类型 T x T y x 但是 我无法理解多维和锯齿状数组的转换规则 string a new string 1 string b new string 1 string c new st
c
multidimensionalarray
jaggedarrays
nullablereferencetypes
可能返回 default(T) 的异步泛型方法的正确可为 null 注释
我正在将代码库转换为具有可为空引用类型的 C 8 我遇到了一种与该方法类似的方法在这个问题中 https stackoverflow com questions 54593923 nullable reference types with
c
nullablereferencetypes
我可以告诉 C# 可空引用一个方法实际上是对字段的空检查吗
考虑以下代码 nullable enable class Foo public string Name get set public bool HasName gt Name null public void NameToUpperCase
c
nullablereferencetypes
.net core 中是否有任何公共 MemberNotNull/MemberNotNullWhen 属性
不久前我读过以下关于C 8中可空引用分析的文章 https www meziantou net csharp 8 nullable reference types htm https www meziantou net csharp 8 n
c
C80
nullablereferencetypes
如何使用 System.Text.Json 处理可为 null 的引用类型?
我已将项目升级到 net core 3 0 并且正在重构项目以使用新的可为空引用类型功能 但由于以下问题很快就陷入困境 假设我使用一个 REST api 它返回以下 JSON Name Volvo 240 Year 1989 此 api 始
json
netcore30
nullablereferencetypes
systemtextjson
使用 DTO 可空引用类型的最佳实践 [关闭]
Closed 这个问题是基于意见的 help closed questions 目前不接受答案 我有一个 DTO 它是通过从 DynamoDB 表读取数据来填充的 假设目前看起来像这样 public class Item public st
c
C80
nonnullable
nullablereferencetypes
可空字符串 (string?) 和初始化为可原谅空值的字符串 (字符串 s = null!) 之间有什么区别
可空字符串 string 和初始化为可原谅空值的字符串 字符串 s null 之间有什么区别 public string nullableString get set null public string forgiveString get
c
NET
Nullable
nullablereferencetypes
可空引用类型和构造函数警告
我正在尝试在我的项目中采用 C 8 的可为空引用类型 并使其与 EF Core 顺利配合 下列的本指南 https learn microsoft com en us ef core miscellaneous nullable refer
c
constructor
EntityFrameworkCore
C80
nullablereferencetypes
如何将所有 C# 8 可空引用警告视为错误?
使用 Visual Studio 2019 v16 3 2 将 NET Core 3 0 项目设置为 C 8 并启用可为 null 的引用类型
c
C80
nullablereferencetypes
使用 C# Nullable 引用类型将外部 dll 中的所有类型视为可为 null
我在项目中使用 C Nullable 引用类型 并且引用了一些不支持 Nullable 引用类型的其他 dll 我可以以某种方式告诉编译器外部 dll 中的所有属性都可以为空吗 默认情况下 编译器将所有内容显示为非空 未注释代码中的值被视为
c
NET
nullablereferencetypes
C#:通用 T 的默认值?不为空;行为随着通用约束而改变
我有一个泛型类 应该对 不可为空 引用和值类型 参数 返回 进行操作 但内部需要可以为空的字段 using System public class Gen
c
generics
Nullable
nullablereferencetypes
C# 无法使“notnull”类型可为空
我正在尝试创建一个类似于 Rust 的类型Result或哈斯克尔的Either到目前为止我已经做到了 public struct Result
c
generics
typeconstraints
C80
nullablereferencetypes
为什么此代码会给出“可能的空引用返回”编译器警告?
考虑以下代码 using System nullable enable namespace Demo public sealed class TestClass public string Test bool isNull test nul
c
nullablereferencetypes
c# editorconfig CA1062 具有可空引用类型的空检查验证方法(用于保护子句)
我创建了一个小dotnetstandard 2 1解决方案中的库项目 我想测试一下使用可空引用类型 https learn microsoft com en us dotnet csharp nullable references 作为其中
c
codeanalysis
EditorConfig
nullablereferencetypes
C# 8 可空值和结果容器
我有一个IResult
c
generics
C80
nullablereferencetypes
如何对解决方案中的所有文件禁用#nullable
我想将我的代码库迁移到可为空的引用 之一迁移策略 https learn microsoft com en us dotnet csharp nullable migration strategies包括添加 nullable disabl
c
nullablereferencetypes
C# 8 在返回具有可为空约束的可为空泛型时发出警告
这段代码 public T Foo
c
generics
nullablereferencetypes
提取方法中的空验证
我使用 c 8 和可空分析器 csproj
c
NetCore
C80
nullablereferencetypes
即使参数没有 null 约束,也会收到有关可为 null 类型参数的错误
我有一个通用界面IDataAdapter
c
Nullable
C80
nullablereferencetypes
1
2
»