💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱@programming.devcake to C Sharp@programming.devEnglish · 7 months agoWriting “string.IsNullOrEmpty” using pattern matching and comparing the resulting codewww.tabsoverspaces.comexternal-linkmessage-square4fedilinkarrow-up120arrow-down10cross-posted to: dotnet@programming.dev
arrow-up120arrow-down1external-linkWriting “string.IsNullOrEmpty” using pattern matching and comparing the resulting codewww.tabsoverspaces.com💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱@programming.devcake to C Sharp@programming.devEnglish · 7 months agomessage-square4fedilinkcross-posted to: dotnet@programming.dev
minus-squareRonSijm@programming.devlinkfedilinkarrow-up4·6 months 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