Changes IndexFieldPolicies to be a StaticFieldCollection which is a keyed collection instead of using Linq and iterating to find the values in critical code

This commit is contained in:
Shannon
2017-02-01 16:48:09 +11:00
parent 5b2212829c
commit 27283754c0
6 changed files with 78 additions and 37 deletions

View File

@@ -0,0 +1,23 @@
using System.Collections.ObjectModel;
namespace UmbracoExamine
{
internal class StaticFieldCollection : KeyedCollection<string, StaticField>
{
protected override string GetKeyForItem(StaticField item)
{
return item.Name;
}
/// <summary>
/// Implements TryGetValue using the underlying dictionary
/// </summary>
/// <param name="key"></param>
/// <param name="field"></param>
/// <returns></returns>
public bool TryGetValue(string key, out StaticField field)
{
return Dictionary.TryGetValue(key, out field);
}
}
}