Return Value
A new MySqlConnection object.
Creates a new MySqlConnection object with the properties that have the same values as those of the original object. However, changing properties of the new object has no influence on the values of the same properties of the original object.
Note that state of the new instance is always Closed, regardless of the state of original instance.
public void CloneAConnection() { MySqlConnection myConnection = new MySqlConnection( "User Id=root;Host=localhost;Database=Test;"); MySqlConnection myConnection2 = (MySqlConnection)myConnection.Clone(); Console.WriteLine(myConnection2.UserId); }
Public Sub CloneAConnection() Dim myConnection As New MySqlConnection( _ "User Id=root;Host=localhost;Database=Test;") Dim myConnection2 As MySqlConnection = CType(myConnection.Clone(), MySqlConnection) Console.WriteLine(myConnection2.UserId) End Sub