dotConnect for Adobe Commerce Documentation
Devart.Data.Magento Namespace / MagentoConnection Class / Clone Method
Example

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

Return Value

A new MagentoConnection object.
Remarks

Creates a new MagentoConnection 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 MagentoConnection. To make sure all the properties are inherited, one of them (UserId) is written to the console.
public void CloneAConnection()
{
  MagentoConnection adobe commerceConnection = new MagentoConnection(
      "domain=192.168.10.68/magento;user=Test;apikey=testpassword;");
  MagentoConnection adobe commerceConnection2 = (MagentoConnection)adobe commerceConnection.Clone();
  Console.WriteLine(adobe commerceConnection2.UserId);
}
Public Sub CloneAConnection()
  Dim adobe commerceConnection As New MagentoConnection( _
      "domain=192.168.10.68/magento;user=Test;apikey=testpassword;")
  Dim adobe commerceConnection2 As MagentoConnection = CType(adobe commerceConnection.Clone(), MagentoConnection)
  Console.WriteLine(adobe commerceConnection2.UserId)
End Sub
See Also