Mono Class Library: System.Version Overview | Members

System.Version.Equals Method

Determines whether the current instance and the specified object represent the same type and value. [Edit]

public override bool Equals (object obj)

Parameters

obj
The object to compare to the current instance. [Edit]
obj
Documentation for this section has not yet been entered. [Edit]

Returns

A bool where true indicates obj is the same type as the current instance and has equal Version.Major, Version.Minor, Version.Build, and Version.Revision properties as the current instance. If obj is a null reference or is not an instance of Version, returns false. [Edit]

Remarks

Note: This method overrides object.Equals(object).
[Edit]

Example

C# Example
using System;
class VersionEqualsExample {
   static void testEquals(Version v1, Version v2) {
      Console.Write("It is {0} that version ",
                    v1.Equals(v2));
      Console.WriteLine("{0} is equal to {1}.",
                    v1, v2);
   }
   public static void Main() {
      Version vers1 = new Version( "6.1.2.4" );
      Version vers2 = new Version( 6, 1 );
      testEquals( vers1, vers1 );
      testEquals( vers1, vers2 );
   }
}
   

The output is

It is True that version 6.1.2.4 is equal to 6.1.2.4.
It is False that version 6.1.2.4 is equal to 6.1.

Requirements

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