r/csharp • • Aug 18 '22

Nullable Reference Migration – How to decide the nullability ?

https://thecodeblogger.com/2022/08/16/nullable-reference-migration-how-to-decide-the-nullability/
33 Upvotes

30 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Aug 18 '22

[removed] — view removed comment

1

u/chrisxfire Aug 18 '22

is that done by using string.Empty as a default value in the property definition?

0

u/[deleted] Aug 18 '22

[removed] — view removed comment

2

u/detroitmatt Aug 18 '22

I really don't like "store null as empty" as a design pattern because then empty just becomes the new null. it doesn't crash your program, but it still produces bugs in the form of logic errors which you have to do checks like if(m_CommandText != "") at which point you may as well have done a null check instead.