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

Allow passing in StringComparer or StringComparison for object based lookups #30

Open
2 tasks
crozone opened this issue Aug 20, 2021 · 0 comments
Open
2 tasks
Milestone

Comments

@crozone
Copy link
Owner

crozone commented Aug 20, 2021

Preface

It is currently possible to change the key equality behaviour when passing in a lookup Dictionary<string, T> by specifying a specific StringComparer in the dictionary constructor. This is passed into the dictionary constructor as an IEqualityComparer<string>, allowing the user to set this before calling .FormatWith.

For example:

var formatted = template.FormatWith(new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
    ["key1"] = value1
});
  • (TODO: Add the above example to the README.md)

However, when using the object based lookup (eg with an anonymous type), the key lookup behaviour is specified internally and there is no way for the user to specify the StringComparer or StringComparison kind.

Tasks

  • Add extra arguments to the object based FormatWith() overloads to allow this string comparison to be changed.
@crozone crozone added this to the 4.0 milestone Aug 20, 2021
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