Source/NFX/MiscUtils.cs
/// <summary>
/// Interprets template of the form:  Some text {@value_name@:C} by replacing with property/field values.
/// Note: this function does not recognize escapes for simplicity (as escapes can be replaced by regular strings instead).
/// Matched is set to true if at least one property match was made
/// </summary>
Interprets template of the form:  Some text :C by replacing with property/field values.
Note: this function does not recognize escapes for simplicity (as escapes can be replaced by regular strings instead).
Matched is set to true if at least one property match was made
Interprets template of the form : Some text : C by replacing with property / field values . Note : this function does not recognize escapes for simplicity ( as escapes can be replaced by regular strings instead ) . Matched is set to true if at least one property match was made
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
    public static string ArgsTpl(this string tpl, object args, out bool matched)
    {
        matched = false;
        if (tpl==null || args==null) return null;
        var result = tpl;
        var t = args.GetType();
        var lst = new List<object>();
        foreach(var pi in t.GetProperties())
        {
          var val = pi.GetValue(args);
          if (val==null) val = string.Empty;
          lst.Add(val);
          var replacedResult = result.Replace('@'+pi.Name+'@', (lst.Count-1).ToString());
          if (!string.Equals(result, replacedResult, StringComparison.Ordinal))
           matched = true;
          result = replacedResult;
        }
        return result.Args(lst.ToArray());
    }
[ System . Runtime . CompilerServices . MethodImpl ( System . Runtime . CompilerServices . MethodImplOptions . AggressiveInlining ) ] public static string ArgsTpl ( this string tpl , object args , out bool matched ) { matched = false ; if ( tpl == null || args == null ) return null ; var result = tpl ; var t = args . GetType ( ) ; var lst = new List < object > ( ) ; foreach ( var pi in t . GetProperties ( ) ) { var val = pi . GetValue ( args ) ; if ( val == null ) val = string . Empty ; lst . Add ( val ) ; var replacedResult = result . Replace ( ' ' + pi . Name + ' ' , ( lst . Count - 1 ) . ToString ( ) ) ; if ( ! string . Equals ( result , replacedResult , StringComparison . Ordinal ) ) matched = true ; result = replacedResult ; } return result . Args ( lst . ToArray ( ) ) ; }
Interprets template of the form:  Some text {@value_name@:C} by replacing with property/field values.
Interprets template of the form : Some text { @value_name@ : C } by replacing with property / field values .
string
this
args
object
bool
out