DbConnectionStringBuilder.AppendKeyValuePair Method (StringBuilder, String, String)
Provides an efficient and safe way to append a key and value to an existing StringBuilder object.
Assembly: System.Data (in System.Data.dll)
public static void AppendKeyValuePair( StringBuilder builder, string keyword, string value )
This method allows developers using a StringBuilder to create a collection of key/value pairs to be able to take advantage of the features included in the DbConnectionStringBuilder class when you add key/value pairs, without having to incur the overhead of creating and maintaining a DbConnectionStringBuilder instance. The AppendKeyValuePair method formats the key and value correctly and adds the new string to the supplied StringBuilder.
If some process has created a connection string, but now an application must perform a simple modification to that connection string, it may be more efficient to just add the key/value pair using a StringBuilder object. Instead of creating a new DbConnectionStringBuilder, developers can call the AppendKeyValuePair method, passing in a StringBuilder that contains the supplied connection string. The following procedure shows a simple example of this technique.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.