aspnet / Routing

[Archived] Middleware for routing requests to application logic. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
272 stars 122 forks source link

Prefer StringComparison over StringComparer when not using comparers #870

Closed JamesNK closed 6 years ago

JamesNK commented 6 years ago

https://stackoverflow.com/a/8918112/11829

rynowak commented 6 years ago

The code change seem fine, but I've read that post over a few times and I still don't get it. How does this make user's lives better? Does this more perf?

JamesNK commented 6 years ago

There is no real benefit, it's just StringComparer is for cases when an API uses IComparer, e.g. the Dictionary comparer, and StringComparison is for regular string comparisons.

rynowak commented 6 years ago

Ok - you get an approve because its clearer? I guess?

JamesNK commented 6 years ago

You have forgotten the most valuable thing of all: 1 James point