Why don't I get a warning about possible dereference of a null in C# 8 with a class member of a struct?
问题 In a C# 8 project with nullable reference types enabled, I have the following code which I think should give me a warning about a possible null dereference, but doesn't: public class ExampleClassMember { public int Value { get; } } public struct ExampleStruct { public ExampleClassMember Member { get; } } public class Program { public static void Main(string[] args) { var instance = new ExampleStruct(); Console.WriteLine(instance.Member.Value); // expected warning here about possible null