src/Misc/EFTools/XmlCore/Common/Diagnostics/EFToolsTraceUtils.cs
/// <summary>
///     Formats an enumerable collection of objects into a string, calling the converter delegate on each to get a string
/// </summary>
Formats an enumerable collection of objects into a string, calling the converter delegate on each to get a string
Formats an enumerable collection of objects into a string calling the converter delegate on each to get a string
internal static string FormatEnumerable<T>(
            IEnumerable<T> enumerable, Func<T, string> converter, bool newlineForEach = false,
            string newlineIndent = DefaultIndent, string listStart = DefaultListStart, string listEnd = DefaultListEnd,
            string listSeparator = DefaultListSeparator)
        {
            var sb = new StringBuilder();
            sb.Append(listStart);
            var first = true;
            foreach (var t in enumerable)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    if (newlineForEach)
                    {
                        sb.AppendLine();
                        sb.Append(newlineIndent);
                    }
                    else
                    {
                        sb.Append(listSeparator);
                    }
                }
                sb.Append(converter(t));
            }
            sb.Append(listEnd);
            return sb.ToString();
        }
internal static string FormatEnumerable < T > ( IEnumerable < T > enumerable , Func < T , string > converter , bool newlineForEach = false , string newlineIndent = DefaultIndent , string listStart = DefaultListStart , string listEnd = DefaultListEnd , string listSeparator = DefaultListSeparator ) { var sb = new StringBuilder ( ) ; sb . Append ( listStart ) ; var first = true ; foreach ( var t in enumerable ) { if ( first ) { first = false ; } else { if ( newlineForEach ) { sb . AppendLine ( ) ; sb . Append ( newlineIndent ) ; } else { sb . Append ( listSeparator ) ; } } sb . Append ( converter ( t ) ) ; } sb . Append ( listEnd ) ; return sb . ToString ( ) ; }
Formats an enumerable collection of objects into a string, calling the converter delegate on each to get a string
Formats an enumerable collection of objects into a string calling the converter delegate on each to get a string
enumerable
IEnumerable<T>
converter
Func<T, string>
newlineForEach
bool
newlineIndent
string
listStart
string
listEnd
string
listSeparator
string