Net.Sf.Dbdeploy.UniqueChange.CompareTo C# (CSharp) Method

CompareTo() public method

Compares the object to another giving a result of less than, equal to, or greater than.
public CompareTo ( object obj ) : int
obj object The object to compare.
return int
        public int CompareTo(object obj)
        {
            var other = (UniqueChange)obj;

            // Compare versions if both folders are in version format v1.0.0.0.
            int result;
            if (this.Version != null && other.Version != null)
            {
                result = this.Version.CompareTo(other.Version);
            }
            else
            {
                // Compare folder names as is.
                result = string.Compare(this.Folder, other.Folder, StringComparison.InvariantCultureIgnoreCase);
            }

            // Compare script number of folders are the same.
            if (result == 0)
            {
                result = this.ScriptNumber.CompareTo(other.ScriptNumber);
            }

            return result;
        }