Created
May 7, 2020 21:09
-
-
Save enisn/fee3724bf4de5fc05dabae35c4bcd0ed to your computer and use it in GitHub Desktop.
Challenge #2 - Solution - BindObjectProperties Last
This file contains hidden or 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
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