Skip to content

Can't Reference Capitalized Hashtable Elements #521

Closed

Description

@AceCoderLaura

Attempting to reference a Hashtable element with a key containing an uppercase letter will fail. Dictionaries however work fine.

Example:

using System.Collections;
using HandlebarsDotNet;

const string template = @"Hello {{ NAME }}, have a nice day.";

var compiledTemplate = Handlebars.Compile(template);

var notWorkingOutput = compiledTemplate(new Hashtable
{
    { "NAME", "bob" }
});

var workingOutput = compiledTemplate(new Dictionary<string,string>()
{
    { "NAME", "alice" }
});

Console.WriteLine(workingOutput);
Console.WriteLine(notWorkingOutput);

Activity

  1. rexm commented on Jun 22, 2022

    @rexm
    Member

    What happens with a HashTable element with a lowercase key?

  2. AceCoderLaura commented on Aug 30, 2022

    @AceCoderLaura
    Author

    If you use a lowercase key in the Hashtable you can reference it with any casing from the template.

  3. added a commit that references this issue on Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions