diff --git a/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs b/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs index d3b950b4..0faea436 100644 --- a/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs +++ b/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListItem.cs @@ -22,6 +22,8 @@ using System; using System.Collections.Generic; using System.Linq; +using MBS.Framework.Collections.Generic; + namespace UniversalEditor.ObjectModels.PropertyList { public abstract class PropertyListItem : ICloneable @@ -48,12 +50,14 @@ namespace UniversalEditor.ObjectModels.PropertyList } } + private Dictionary cacheOfT = new Dictionary(); public T OfType(string name) where T : PropertyListItem { - for (int i = 0; i < Count; i++) + T[] items = this.OfType(); + for (int i = 0; i < items.Length; i++) { - if (this[i].Name == name && this[i] is T) - return (T)this[i]; + if (items[i].Name == name) + return items[i]; } return null; }