public Int32 CompareTo(IconImage other) { if (ParentIcon.Type == IconType.Icon) { // sort by color depth first, then size (smallest first) Int32 color = BitCount.CompareTo(other.BitCount); if (color != 0) { return(color); } return(-Size.Width.CompareTo(other.Size.Width)); } else { // sort by size first (largest first), then color depth Int32 size = Size.Width.CompareTo(other.Size.Width); if (size != 0) { return(size); } return(BitCount.CompareTo(other.BitCount));; } }
public int CompareTo(IconImage other) { if (ParentIcon.Type == IconType.Icon) { // sort by color depth first, then size (smallest first) var color = BitCount.CompareTo(other.BitCount); if (color != 0) { return(color); } return(-Size.Width.CompareTo(other.Size.Width)); } // sort by size first (largest first), then color depth var size = Size.Width.CompareTo(other.Size.Width); return(size != 0 ? size : BitCount.CompareTo(other.BitCount)); }