Click or drag to resize

StringExtensionsJoinKeyValuePairs Method

Combines a dictionary of key-value pairs in to a string.

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public static string JoinKeyValuePairs(
	this IDictionary<string, string> pairs,
	char parameterDelimiter = ';',
	char keyValueDelimiter = '=',
	char startValueDelimiter = '{',
	char endValueDelimiter = '}'
)
View Source

Parameters

pairs  IDictionaryString, String
Dictionary of key-value pairs.
parameterDelimiter  Char  (Optional)
Character that delimits one key-value pair from another (e.g. ';').
keyValueDelimiter  Char  (Optional)
Character that delimits a key from its value (e.g. '=').
startValueDelimiter  Char  (Optional)
Optional character that marks the start of a value such that value could contain other parameterDelimiter or keyValueDelimiter characters (e.g., "{").
endValueDelimiter  Char  (Optional)
Optional character that marks the end of a value such that value could contain other parameterDelimiter or keyValueDelimiter characters (e.g., "}").

Return Value

String
A string of key-value pairs.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDictionaryString, String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Values will be escaped within startValueDelimiter and endValueDelimiter to contain nested key/value pair expressions like the following: normalKVP=-1; nestedKVP={p1=true; p2=0.001}, when either the parameterDelimiter or keyValueDelimiter are detected in the value of the key/value pair.
See Also