💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱 to C SharpEnglish · 6 months agoWriting “string.IsNullOrEmpty” using pattern matching and comparing the resulting codewww.tabsoverspaces.comexternal-linkmessage-square4fedilinkarrow-up120arrow-down10
arrow-up120arrow-down1external-linkWriting “string.IsNullOrEmpty” using pattern matching and comparing the resulting codewww.tabsoverspaces.com💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱 to C SharpEnglish · 6 months agomessage-square4fedilink
minus-squareRonSijmlinkfedilinkarrow-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