diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs index cd60f9fa3dc..bd7468a8ca7 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using System.ComponentModel.Design.Serialization; -using System.Collections; using System.Globalization; using System.Reflection; using System.Windows.Media; // TypeConverterHelper, UriHolder @@ -53,15 +52,6 @@ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinati return false; } - /// - /// Gets the public/static properties of the Cursors class - /// - /// PropertyInfo array of the objects properties - private PropertyInfo[] GetProperties() - { - return typeof(Cursors).GetProperties(BindingFlags.Public | BindingFlags.Static); - } - /// /// StandardValuesCollection method override /// @@ -69,19 +59,22 @@ private PropertyInfo[] GetProperties() /// TypeConverter.StandardValuesCollection public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { - if(this._standardValues == null) + if(_standardValues is null) { - ArrayList list1 = new ArrayList(); - PropertyInfo[] infoArray1 = this.GetProperties(); - for(int num1 = 0; num1 < infoArray1.Length; num1++) + PropertyInfo[] properties = typeof(Cursors).GetProperties(BindingFlags.Public | BindingFlags.Static); + object[] values = new object[properties.Length]; //Could use Cursor but its wrapped in ICollection anyways + + for (int i = 0; i < properties.Length; i++) { - PropertyInfo info1 = infoArray1[num1]; - object[] objArray1 = null; - list1.Add(info1.GetValue(null, objArray1)); + PropertyInfo info = properties[i]; + + values[i] = info.GetValue(null, null); } - this._standardValues = new TypeConverter.StandardValuesCollection(list1.ToArray()); + + _standardValues = new TypeConverter.StandardValuesCollection(values); } - return this._standardValues; + + return _standardValues; } ///