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