コード例 #1
0
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            ModuleVersion version1 = new ModuleVersion();

            version1.major    = this.major;
            version1.minor    = this.minor;
            version1.build    = this.build;
            version1.revision = this.revision;
            return(version1);
        }
コード例 #2
0
        /// <summary>
        /// Equalss the specified obj.
        /// </summary>
        /// <param name="obj">Obj.</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if ((obj == null) || !(obj is ModuleVersion))
            {
                return(false);
            }
            ModuleVersion version1 = (ModuleVersion)obj;

            if (((this.major == version1.Major) && (this.minor == version1.Minor)) && (this.build == version1.Build) && (this.revision == version1.Revision))
            {
                return(true);
            }
            return(false);
        }
コード例 #3
0
        /// <summary>
        /// Compares to.
        /// </summary>
        /// <param name="obj">Obj.</param>
        /// <returns></returns>
        public int CompareTo(object version)
        {
            if (version == null)
            {
                return(1);
            }
            if (!(version is ModuleVersion))
            {
                throw new ArgumentException("Arg_MustBeVersion");
            }
            ModuleVersion version1 = (ModuleVersion)version;

            if (this.major != version1.Major)
            {
                if (this.major > version1.Major)
                {
                    return(1);
                }
                return(-1);
            }
            if (this.minor != version1.Minor)
            {
                if (this.minor > version1.Minor)
                {
                    return(1);
                }
                return(-1);
            }
            if (this.build != version1.Build)
            {
                if (this.build > version1.Build)
                {
                    return(1);
                }
                return(-1);
            }
            if (this.revision == version1.Revision)
            {
                return(0);
            }
            if (this.revision > version1.Revision)
            {
                return(1);
            }
            return(-1);
        }