public int CompareTo(object obj) { if (obj == null) { return(1); // non-existant is always low } ShellItem Other = (ShellItem)obj; // UPDATE: Error Handling for ShellItem.CompareTo if (Other == null) { #if DEBUG throw new ArgumentException("Invalid argument for ShellItem.CompareTo"); #endif return(0); // Ignore this in release builds } if (!m_HasDispType) { SetDispType(); } int cmp = Other.SortFlag - m_SortFlag; // Note the reversal if (cmp != 0) { return(cmp); } else { if (IsDisk) // implies that both are { return(string.Compare(this.FileSystemPath, Other.FileSystemPath)); } else { // return String.Compare(m_DisplayName, Other.DisplayName) return(StringLogicalComparer.CompareStrings(this.DisplayName, Other.DisplayName)); } } }
private static StringLogicalComparer _default; // = new StringLogicalComparer(); private StringLogicalComparer() { _default = new StringLogicalComparer(); } //New