dotConnect for Dynamics 365 Documentation
Devart.Data.Dynamics Namespace / DynamicsCommand Class / Clone Method
Example

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

    Return Value

    A new DynamicsCommand object in which all property values are the same as the original.
    Remarks
    Use this method when you need to create a new DynamicsCommand object that is absolutely like existing one.
    Example
    This example shows how to clone a DynamicsCommand . To make sure all the properties are inherited, one of them (CommandText) is written to the console.
    public void CloneACommand()
    {
      DynamicsCommand dynamicsCommand = new DynamicsCommand("SELECT * FROM contact");
            DynamicsCommand dynamicsCommand2 = (DynamicsCommand)dynamicsCommand.Clone();
      Console.WriteLine(dynamicsCommand2.CommandText);
    }
    Public Sub CloneACommand()
      Dim dynamicsCommand As New DynamicsCommand("SELECT * FROM contact")
      Dim dynamicsCommand2 As DynamicsCommand = CType(dynamicsCommand.Clone(), DynamicsCommand)
      Console.WriteLine(dynamicsCommand2.CommandText)
    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