Blog: 2018 September

C# 8: The output of Nullable Reference Types and how to reflect it

September 28, 2018, (updated on October 15, 2018), 2 comments, Software Development

After reading some articles about the new C# 8 feature Nullable Reference Types, one question still was unanswered: How does a compiled assembly with nullable types enabled look like and how can I access the nullability information via reflection? Because I couldn’t find an article with an answer, I had to figure it out myself. First I wrote a simple class which I wanted to analyze: [module: System.Runtime.CompilerServices.NonNullTypes(true)] class Test { public string? Foo {get; set;} public void Bar(string? baz, string buz) { } } With the help of I compiled it with C# 8 and looked at the […] Read more...

Tags: , , ,

  Page 1 of 1