public string ShouldApplyFormatOptions(CollectionFormatOptions options)
        {
            var format = new CollectionFormat()
                         .AddOptions(options)
                         .SetCollectionPrefixAndSuffix("[", "]")
                         .SetIndexValuePairPrefixAndSuffix("<", ">")
                         .SetIndexPrefixAndSuffix("'", "'")
                         .SetValuePrefixAndSuffix("'", "'")
                         .SetIndexValueSeparator(":")
                         .SetIndexValuePairSeparator(",");

            return(format.Compile()(new [] { "John", "", null }));
        }
Пример #2
0
 /// <summary>
 /// Sets <see cref="Options"/> and returns updated <see cref="CollectionFormat"/>.
 /// </summary>
 /// <param name="options">Determines overall structure of formatted output.</param>
 public CollectionFormat AddOptions(CollectionFormatOptions options)
 {
     Options |= options;
     return(this);
 }