dotConnect for Salesforce Documentation
Devart.Data.Salesforce Namespace / SalesforceConnection Class / Clone Method
Example

Clone Method (SalesforceConnection)
Creates a new object that is a copy of the current instance.
Syntax
'Declaration
 
Public Function Clone() As Object
 

Return Value

A new SalesforceConnection object.
Remarks

Creates a new SalesforceConnection 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.

Example
This example shows how to clone a SalesforceConnection. To make sure all the properties are inherited, one of them (UserId) is written to the console.
public void CloneAConnection()
{
  SalesforceConnection salesforceConnection = new SalesforceConnection(
      "Server=login.salesforce.com;User Id= name@company.com;Password=mypassword;Security Token=qweASDzcx1234567890rtyui;");
  SalesforceConnection salesforceConnection2 = (SalesforceConnection)salesforceConnection.Clone();
  Console.WriteLine(salesforceConnection2.UserId);
}
Public Sub CloneAConnection()
  Dim salesforceConnection As New SalesforceConnection( _
      "Server=login.salesforce.com;User Id= name@company.com;Password=mypassword;Security Token=qweASDzcx1234567890rtyui;")
  Dim salesforceConnection2 As SalesforceConnection = CType(salesforceConnection.Clone(), SalesforceConnection)
  Console.WriteLine(salesforceConnection2.UserId)
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also