Convert Enum into list

WP Upload Directory not writable! Check file and directory permissions
Convert Enum into list

Adding custom index in Sitecore 7.2

WP Upload Directory not writable! Check file and directory permissions
Add custom lucene index in Sitecore 7.2 tooked me few hours to understand how to configure that. Following are the some easy step to create custom index using some default index settings. 

Flatten an enumerable recursively

WP Upload Directory not writable! Check file and directory permissions
/// <summary> /// Flatten an enumerable recursively. /// </summary> /// <remarks>A bit like SelectMany.</remarks> /// <typeparam name="T"></typeparam> /// <param name="enumerable"></param> /// <param name="enumerableSelector"></param> /// <returns>A new sequence of T</returns> public static IEnumerable<T> FlattenDeep<T>(this IEnumerable<T> enumerable, Func<T, IEnumerable<T>> enumerableSelector) { foreach (var element in enumerable) { yield return element; var candidate = enumerableSelector(element); if (candidate == ...

Get results in batch using LINQ

WP Upload Directory not writable! Check file and directory permissions
Return results in batch using LINQ, mostly used in rendering public static class LinqExtensions { public static IEnumerable<IEnumerable<TSource>> Batch<TSource>(this IEnumerable<TSource> source, int batchSize) { var batch = new List<TSource>(); foreach (var item in source) { batch.Add(item); if (batch.Count == batchSize) { yield return batch; batch = new List<TSource>(); } } if (batch.Any()) yield return batch; ...