ClrPlus.Core.Extensions.StringExtensions.FormatWithMacros C# (CSharp) Method

FormatWithMacros() public static method

public static FormatWithMacros ( this value, GetMacroValueDelegate getMacroValue, object eachItem = null, GetMacroValueDelegate preprocessValue = null, GetMacroValueDelegate postprocessValue = null ) : string
value this
getMacroValue GetMacroValueDelegate
eachItem object
preprocessValue GetMacroValueDelegate
postprocessValue GetMacroValueDelegate
return string
        public static string FormatWithMacros(this string value, GetMacroValueDelegate getMacroValue, object eachItem = null, GetMacroValueDelegate preprocessValue = null, GetMacroValueDelegate postprocessValue = null) {
            if (preprocessValue != null) {
                foreach (GetMacroValueDelegate preprocess in preprocessValue.GetInvocationList()) {
                    value = preprocess(value);
                }
            }

            if (getMacroValue != null) {
                value = value.ProcessMacroInternal(getMacroValue, eachItem); // no macro handler?, just return 
            }

            if (postprocessValue != null) {
                foreach (GetMacroValueDelegate postprocess in postprocessValue.GetInvocationList()) {
                    value = postprocess(value);
                }
            }

            return value;
        }