Created
March 27, 2019 09:44
-
-
Save sombochea/6522b4f1d2fcb5aea86794043cfbcdad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
public class User { | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
} | |
public class Company { | |
public string Name { get; set; } | |
public string City { get; set; } | |
} | |
public class TemplateParser { | |
// To Implement | |
} | |
class Solution { | |
public string solution(string S) { | |
var templateParser = new TemplateParser() | |
.Register<User>("{{UserFirstName}}", (user) => user.FirstName) | |
.Register<User>("{{UserLastName}}", (user) => user.LastName) | |
.Register<Company>("{{CompanyName}}", (company) => company.Name) | |
.Register<Company>("{{CompanyCity}}", (company) => company.City); | |
var objects = new object[] { | |
new User() { FirstName = "John", LastName = "Doe" }, | |
new Company() { Name = "ABC Company", City = "Quito" } | |
}; | |
return templateParser.Parse(S, objects); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment