Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string Log<T> (this IEnumerable<T> collection) => Log (collection, i => i);
- public static string Log<T, TResult> (this IEnumerable<T> collection, System.Func<T, TResult> selector, string Format = "{0}", string separator = "\n")
- {
- string result = "";
- result = collection != null ? collection.Count ().ToString () : "Null";
- result += " items {0}\n------\n".AsFormat (typeof (T).Name)
- foreach (var item in collection.Select (selector))
- {
- var parameters = new object[] { item };
- result += string.Format (Format + separator, parameters);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment