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

Rename StringExtensions.Replace so they don't conflict with native methods #64

Closed
scottdorman opened this issue Sep 17, 2020 · 0 comments
Assignees
Milestone

Comments

@scottdorman
Copy link
Owner

The StringExtensions.Replace methods can potentially conflict with native string methods in .NET 2.1. Specifically, the compiler seems to prefer Replace(String oldValue, String? newValue, StringComparison comparisonType) rather than the Replace(this string source, string oldValue, string newValue, int occurrences) extension when occurrences == 0.

This can be mitigated by renaming the Replace extensions to something more descriptive, like ReplaceOccurrences. It also doesn't really make sense that occurrences is allowed to be 0, as that is effectively a NoOp.

@scottdorman scottdorman added this to the Cadru 5.0 milestone Sep 17, 2020
@scottdorman scottdorman self-assigned this Sep 17, 2020
scottdorman added a commit that referenced this issue Sep 17, 2020
…hat was calling into the native String.Replace method instead of the extension. These Replace extension methods need to be renamed. (#64)
scottdorman added a commit that referenced this issue Nov 18, 2020
Updates #65.
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

1 participant