Skip to content

Instantly share code, notes, and snippets.

@enisn
Created May 7, 2020 21:09
Show Gist options
  • Save enisn/fee3724bf4de5fc05dabae35c4bcd0ed to your computer and use it in GitHub Desktop.
Save enisn/fee3724bf4de5fc05dabae35c4bcd0ed to your computer and use it in GitHub Desktop.
Challenge #2 - Solution - BindObjectProperties Last
public static string BindObjectProperties(this string str, object obj)
{
if (obj == null) return str;
foreach (var item in ExtractParams(str))
{
str = str.Replace("{" + item + "}", obj.GetPropValue(item)?.ToString());
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment