Sdl.Web.Common.Models.MvcData.Equals C# (CSharp) Method

Equals() public method

Determines whether the specified object is equal to the current object.
public Equals ( object obj ) : bool
obj object The object to compare with the current object.
return bool
        public override bool Equals(object obj)
        {
            MvcData other = obj as MvcData;
            if (other == null)
            {
                return false;
            }

            // NOTE: RegionName and RegionAreaName are not included in equality check (these merely carry some additional info).
            if ((ControllerName != other.ControllerName) ||
                (ControllerAreaName != other.ControllerAreaName) ||
                (ActionName != other.ActionName) ||
                (ViewName != other.ViewName) ||
                (AreaName != other.AreaName))
            {
                return false;
            }

            if (RouteValues == null)
            {
                return other.RouteValues == null;
            }
            return RouteValues.SequenceEqual(other.RouteValues);
        }