U4-9582 - perfs, remove Yield method

This commit is contained in:
Stephan
2017-03-21 11:10:37 +01:00
parent f4eb37d44d
commit 0a132ed5ed
2 changed files with 6 additions and 22 deletions

View File

@@ -295,22 +295,5 @@ namespace Umbraco.Core
return list1Groups.Count == list2Groups.Count
&& list1Groups.All(g => g.Count() == list2Groups[g.Key].Count());
}
///<summary>
/// Returns the items of the given enumerable as a pure enumerable.
/// <remarks>
/// When quering lists using methods such as <see cref="M:List.Where"/>, the result, despite appearing to look like and quack like an
/// <see cref="T:Enumerable{T}"/> the type is actually an instance of <see cref="T:System.Linq.Enumerable.WhereEnumerableIterator"/>
/// </remarks>
/// </summary>
///<param name="source">The item to find.</param>
///<returns>The index of the first matching item, or -1 if the item was not found.</returns>
internal static IEnumerable<T> Yield<T>(this IEnumerable<T> source)
{
foreach (var element in source)
{
yield return element;
}
}
}
}

View File

@@ -132,7 +132,6 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
if (nodeIds.Length > 0)
{
var umbHelper = new UmbracoHelper(UmbracoContext.Current);
var objectType = UmbracoObjectTypes.Unknown;
foreach (var nodeId in nodeIds)
@@ -148,8 +147,8 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
}
}
}
//TODO: Get rid of this Yield thing
return multiNodeTreePicker.Yield().Where(x => x != null);
return multiNodeTreePicker;
}
// return the first nodeId as this is one of the excluded properties that expects a single id
@@ -170,11 +169,13 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
{
var item = udi.ToPublishedContent();
if (item != null)
{
multiNodeTreePicker.Add(item);
}
}
}
//TODO: Get rid of this Yield thing
return multiNodeTreePicker.Yield().Where(x => x != null);
return multiNodeTreePicker;
}
// return the first nodeId as this is one of the excluded properties that expects a single id