System.Version.Clone Method

Returns a new Version object whose value is the same as the current Version object.

Syntax

public object Clone ()

Returns

A new object whose values are a copy of the current Version object.

Remarks

If the type of the return value is important, cast the object instance that is returned by this method to a Version object.

Example

The following example clones the version number and writes the result to the console.

C# Example

using System;
class VersionCloneExample {
  public static void Main() {
    Version vers = new Version("6.1.2.4");
    Console.WriteLine("The string representation of the" +
                      " version is {0}.",
                      vers.ToString());
    Version clone = (Version) vers.Clone();
    Console.WriteLine("The original version was" +
                      " successfully cloned.");
    Console.Write("The string representation of the" +
                  " cloned version is {0}.",
                  clone.ToString());
  }
}
   

The output is

The string representation of the version is 6.1.2.4.
The original version was successfully cloned.
The string representation of the cloned version is 6.1.2.4.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0