My code looks like
private bool IsUserAditya(string username)
{
return username == "Aditya"? true : false;
}
Can I shorten it further?
I would appreciate any help on this.
Can I shorten it further?
Yes, a little bit
return username == "Aditya";
Any comparison in C# returns a bool
, so no need to use the conditional operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With