Generation

generate functionWed, 07 Jun 2023

Function that creates a yaml file with razorEngineLight

public void CreateYamlFile(string filePath, string fileName, string yamlFileName, RazorEngineLight razorEngine) { var model = new Model { Header = "header", Body = "body", Footer = "footer" }; var template = "---\r\n" + "Name: @Model.Header\r\n" + "[@Model.Body]\r\n" + "footer: @Model.Footer"; var result = razorEngine.Parse(template, model); File.WriteAllText(filePath + fileName, result); }

Questions about programming?Chat with your personal AI assistant