You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="WebBaseEventKeyComparer.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace System.Web.Configuration
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
internal class WebBaseEventKeyComparer : IEqualityComparer {
|
||||
public new bool Equals(object x, object y) {
|
||||
CustomWebEventKey xKey = (CustomWebEventKey)x;
|
||||
CustomWebEventKey yKey = (CustomWebEventKey)y;
|
||||
|
||||
if (xKey._eventCode == yKey._eventCode && xKey._type.Equals(yKey._type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA2303:FlagTypeGetHashCode", Justification = "CustomWebEventKey is internal - okay")]
|
||||
public int GetHashCode(object obj)
|
||||
{
|
||||
return ((CustomWebEventKey)obj)._eventCode ^ ((CustomWebEventKey)obj)._type.GetHashCode();
|
||||
}
|
||||
|
||||
public int Compare(object x, object y) {
|
||||
CustomWebEventKey xKey = (CustomWebEventKey)x;
|
||||
CustomWebEventKey yKey = (CustomWebEventKey)y;
|
||||
|
||||
int xEventCode = xKey._eventCode;
|
||||
int yEventCode = yKey._eventCode;
|
||||
|
||||
if (xEventCode == yEventCode) {
|
||||
Type xType = xKey._type;
|
||||
Type yType = yKey._type;
|
||||
|
||||
if (xType.Equals(yType)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return Comparer.Default.Compare(xType.ToString(), yType.ToString());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (xEventCode > yEventCode) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user