this.properties.AddRange (properties);
}
-#if NET_2_0
- public
-#else
- internal
-#endif
- PropertyDescriptorCollection (PropertyDescriptor[] properties, bool readOnly) : this (properties)
+ public PropertyDescriptorCollection (PropertyDescriptor[] properties, bool readOnly) : this (properties)
{
this.readOnly = readOnly;
}
public virtual PropertyDescriptor Find (string name, bool ignoreCase)
{
- if (name == null) {
+ if (name == null)
throw new ArgumentNullException ("name");
- }
-#if TARGET_JVM
- if (!ignoreCase)
- {
- foreach (PropertyDescriptor p in properties)
- {
- if (String.Equals (name, p.Name))
- return p;
+ for (int i = 0; i < properties.Count; ++i) {
+ PropertyDescriptor p = (PropertyDescriptor)properties [i];
+ if (ignoreCase) {
+ if (0 == String.Compare (name, p.Name, StringComparison.OrdinalIgnoreCase))
+ return p;
+ }
+ else {
+ if (0 == String.Compare (name, p.Name, StringComparison.Ordinal))
+ return p;
}
- return null;
- }
-#endif
- foreach (PropertyDescriptor p in properties) {
- if (0 == String.Compare (name, p.Name, ignoreCase))
- return p;
}
return null;
}
return properties.GetEnumerator ();
}
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
[MonoTODO]
IDictionaryEnumerator IDictionary.GetEnumerator ()
{
throw new NotImplementedException ();
}
-#if TARGET_JVM
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-#endif
public int IndexOf (PropertyDescriptor value)
{
return properties.IndexOf (value);
public virtual PropertyDescriptorCollection Sort (string[] order, IComparer comparer)
{
PropertyDescriptorCollection col = CloneCollection ();
- ArrayList sorted = col.ExtractItems (order);
- col.InternalSort (comparer);
- sorted.AddRange (col.properties);
- col.properties = sorted;
+ if (order != null) {
+ ArrayList sorted = col.ExtractItems (order);
+ col.InternalSort (comparer);
+ sorted.AddRange (col.properties);
+ col.properties = sorted;
+ } else {
+ col.InternalSort (comparer);
+ }
return col;
}
protected void InternalSort (IComparer ic)
{
+ if (ic == null)
+ ic = MemberDescriptor.DefaultComparer;
properties.Sort (ic);
}
protected void InternalSort (string [] order)
{
- ArrayList sorted = ExtractItems (order);
- InternalSort ((IComparer) null);
- sorted.AddRange (properties);
- properties = sorted;
+ if (order != null) {
+ ArrayList sorted = ExtractItems (order);
+ InternalSort ((IComparer) null);
+ sorted.AddRange (properties);
+ properties = sorted;
+ } else {
+ InternalSort ((IComparer) null);
+ }
}
ArrayList ExtractItems (string[] names)
{
get
{
-#if NET_2_0
return readOnly;
-#else
- return !readOnly;
-#endif
}
}
#if TARGET_JVM //DUAL_IFACE_CONFLICT