1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.Model
7 using System.Collections;
8 using System.Collections.Generic;
10 using System.Activities.Presentation.PropertyEditing;
13 // Compares PropertyEntry instances solely on their DisplayName
15 internal class PropertyEntryNameComparer : IComparer, IComparer<PropertyEntry>
18 public static readonly PropertyEntryNameComparer Instance = new PropertyEntryNameComparer();
20 private static int CompareCore(object x, object y)
22 ModelPropertyEntry j = x as ModelPropertyEntry;
23 ModelPropertyEntry k = y as ModelPropertyEntry;
25 if (j == null && k == null)
38 return string.Compare(j.DisplayName, k.DisplayName, StringComparison.CurrentCulture);
41 // IComparer<PropertyEntry> Members
43 public int Compare(PropertyEntry x, PropertyEntry y)
45 return CompareCore(x, y);
51 public int Compare(object x, object y)
53 return CompareCore(x, y);