public override int GetHashCode() { if (_others == null) { return(Filter.GetHashCode()); } return(ListEquivalentComparer <string> .GetHashCode(_authorizedRoleNames) ^ ListEquivalentComparer <IAuthorizationRequirement> .GetHashCode(_others)); }
///not a true equals - more 'equivalent' - if Filters are the same object return true, otherwise check if the 2 filters ///in any order, contain the same IAuthorizationRequirements. If contains RolesAuthorizationRequirement, is the ///allowed roles string collection equivalent (regardless of order) - that is if the same roles are authorized, the filter is 'equal' public override bool Equals(object obj) { var compareTo = obj as AuthFilterWrapper; if (compareTo == null) { return(false); } bool filtersEqual = Filter.Equals(compareTo.Filter); if (_others == null || filtersEqual) { return(filtersEqual); } return(ListEquivalentComparer <string> .Equals(_authorizedRoleNames, compareTo._authorizedRoleNames) && ListEquivalentComparer <IAuthorizationRequirement> .Equals(_others, compareTo._others)); }