💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱 to C SharpEnglish • 1 month agoWriting “string.IsNullOrEmpty” using pattern matching and comparing the resulting codewww.tabsoverspaces.commessage-square4arrow-up119arrow-down10cross-posted to: dotnet
arrow-up119arrow-down1external-linkWriting “string.IsNullOrEmpty” using pattern matching and comparing the resulting codewww.tabsoverspaces.com💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱 to C SharpEnglish • 1 month agomessage-square4cross-posted to: dotnet
minus-square@RonSijmlink4•1 month agomyStr.IsNullOrEmpty() feels a bit weird to me, because you have to know that it’s an extension method. Otherwise it kinda looks like you might be trying to run a method of something that’s possibly null That’s the same design principle of why ArgumentNullException.ThrowIfNull(myStr) is not an extension method
myStr.IsNullOrEmpty()
feels a bit weird to me, because you have to know that it’s an extension method.Otherwise it kinda looks like you might be trying to run a method of something that’s possibly
null
That’s the same design principle of why
ArgumentNullException.ThrowIfNull(myStr)
is not an extension method