dotConnect for SugarCRM Documentation
Devart.Data.Sugar Namespace / SugarConnection Class / Clone Method
Example

In This Topic
    Clone Method (SugarConnection)
    In This Topic
    Creates a new object that is a copy of the current instance.
    Syntax
    'Declaration
     
    Public Function Clone() As SugarConnection
    public SugarConnection Clone()

    Return Value

    A new SugarConnection object.
    Remarks

    Creates a new SugarConnection 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 SugarConnection. To make sure all the properties are inherited, one of them (UserId) is written to the console.
    public void CloneAConnection()
    {
      SugarConnection sugarConnection = new SugarConnection(
          "server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;");
      SugarConnection sugarConnection2 = (SugarConnection)sugarConnection.Clone();
      Console.WriteLine(sugarConnection2.UserId);
    }
    Public Sub CloneAConnection()
      Dim sugarConnection As New SugarConnection( _
          "server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;")
      Dim sugarConnection2 As SugarConnection = CType(sugarConnection.Clone(), SugarConnection)
      Console.WriteLine(sugarConnection2.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