Server.Commands.CategorySorter.Compare C# (CSharp) Méthode

Compare() public méthode

public Compare ( object x, object y ) : int
x object
y object
Résultat int
		public int Compare( object x, object y )
		{
			string a = null, b = null;

			if ( x is CategoryEntry )
				a = ((CategoryEntry)x).Title;
			else if ( x is CategoryTypeEntry )
				a = ((CategoryTypeEntry)x).Type.Name;

			if ( y is CategoryEntry )
				b = ((CategoryEntry)y).Title;
			else if ( y is CategoryTypeEntry )
				b = ((CategoryTypeEntry)y).Type.Name;

			if ( a == null && b == null )
				return 0;

			if ( a == null )
				return 1;

			if ( b == null )
				return -1;

			return a.CompareTo( b );
		}
	}
CategorySorter