Antaris / RazorEngine

Open source templating engine based on Microsoft's Razor parsing engine
http://antaris.github.io/RazorEngine
Other
2.13k stars 578 forks source link

Handling boolean values with Engine.Razor.RunCompile() #569

Open vkso4 opened 4 years ago

vkso4 commented 4 years ago

Hi, I am getting unexpected results when dealing with boolean values in model. Here is the code: string template1 = @" <add key=""Retired"" value=""@(Model.Details.IsRetired)"" /> "; var model1 = new Person { Forename = "Matt", Surname = "Willander", Age = 25, Details = new Details { IsRetired = true } };

        string result = Engine.Razor.RunCompile(template1, "key", typeof(Person), model1);

The results id :

but I expect it to be:

What do I need to fix it?

Thank you.