Skip to content

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

@crozone

Description

@crozone

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions