Clone Method (UniConnection)
Creates a new object that is a copy of the current instance.
This example shows how to clone a
UniConnection. To make sure all the properties are inherited, one of them (UserId) is written to the console.
|
|---|
public void CloneAConnection()
{
UniConnection myConnection = new UniConnection("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa");
UniConnection myConnection2 = (UniConnection)myConnection.Clone();
Console.WriteLine(myConnection2.UserId);
} |
|
|---|
Public Sub CloneAConnection()
Dim myConnection As New UniConnection("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa")
Dim myConnection2 As UniConnection = CType(myConnection.Clone(), UniConnection)
Console.WriteLine(myConnection2.UserId)
End Sub |