Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCS1156 should change (s == "") to (string.IsNullOrEmpty(s)) instead of (s?.Length == 0) #650

Closed
CaerphillyMediaLtd opened this issue Feb 26, 2020 · 2 comments

Comments

@CaerphillyMediaLtd
Copy link

RCS1156 suggests changing s == "" to s?.Length == 0, but it should instead change it to string.IsNullOrEmpty(s).

.NET already implements this functionality with the IsNullOrEmpty functionality, I don't think it should be reimplemented using the Length field and a null check. The in-built function also increases readability.

@josefpihrt
Copy link
Collaborator

That makes sense.

@davidnmbond
Copy link

@josefpihrt - please revert this. It is perfectly valid to compare a string JUST with string.Empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants