Skip to content

Consider making Position(And possibly Range?) IComparable and adding more operator overloads #376

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

Closed
ajaybhargavb opened this issue Oct 1, 2020 · 3 comments

Comments

@ajaybhargavb
Copy link

It is fairly common to want to check whether a position appears before or after another and it would be nice to have them be easily comparable(like this) instead of having to check the line and character separately.

Here is an example of where this might be useful.

@ajaybhargavb ajaybhargavb changed the title Consider making Position IComparable and adding more operator overloads Consider making Position(And possibly Range?) IComparable and adding more operator overloads Oct 1, 2020
@david-driscoll
Copy link
Member

I think that makes sense.

Should we apply the same thing to Range as well?

@ajaybhargavb
Copy link
Author

Should we apply the same thing to Range as well?

We haven't found the need for it yet. Maybe not given Roslyn doesn't do that either, https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/Portable/Text/LinePositionSpan.cs.

@ajaybhargavb
Copy link
Author

Thanks @david-driscoll

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

No branches or pull requests

2 participants