How can I get close to non-nullable reference types in C# today?

后端 未结 2 1038
眼角桃花
眼角桃花 2020-12-09 16:07

I\'ve read many of the non-nullable questions and answers. It looks like the best way to get close to non-nullable types in C# (4.0) is Jon Skeet\'s NonNullable<> hack.<

2条回答
  •  北海茫月
    2020-12-09 17:07

    I've run into this a few times...I've yet to find anything better than Skeet's solution. It's solved all the cases I've come across, so I have to give it my vote.

    I agree it's a bit of a hacky situation that we have to resort to that...but his fix does solve the problem.

提交回复
热议问题