OptionConverterSubstituteVariables Method Apache log4net™ SDK Documentation
Performs variable substitution in string value from the values of keys found in props.

Namespace: log4net.Util
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

public static string SubstituteVariables(
	string value,
	IDictionary props
)

Parameters

value
Type: SystemString
The string on which variable substitution is performed.
props
Type: System.CollectionsIDictionary
The dictionary to use to lookup variables.

Return Value

Type: String
The result of the substitutions.
Remarks

The variable substitution delimiters are ${ and }.

For example, if props contains key=value, then the call

C#
string s = OptionConverter.SubstituteVariables("Value of key is ${key}.");

will set the variable s to "Value of key is value.".

If no value could be found for the specified key, then substitution defaults to an empty string.

For example, if system properties contains no value for the key "nonExistentKey", then the call

C#
string s = OptionConverter.SubstituteVariables("Value of nonExistentKey is [${nonExistentKey}]");

will set s to "Value of nonExistentKey is []".

An Exception is thrown if value contains a start delimiter "${" which is not balanced by a stop delimiter "}".

See Also

Reference