vdvman1
Implement string properties
Whether you use:
-
string
and string.Empty
- string?
and null
- string
and the required
keyword
- string
and initialise it in the constructor
Depends on what values you want the property to hold and how you want it to be set the first time30 replies
Implement string properties
The first two are equivalent, they use an empty string as the default value
The last makes it
null
instead of an empty string, and since you're using !
it looks like you are using nullable reference types, and since you're storing null into a property that states it isn't null you are potentially going to cause issues30 replies