This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove the line below if you want to inherit .editorconfig settings from higher directories | |
root = true | |
# C# files | |
[*.cs] | |
#### Core EditorConfig Options #### | |
# Indentation and spacing | |
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string Format(string format, IDictionary<string, object> valueProvider) | |
{ | |
if (valueProvider == null) | |
{ | |
throw new ArgumentNullException(nameof(valueProvider)); | |
} | |
return Format(format, name => valueProvider.TryGetValue(name, out var value) ? (true, value) : (false, null)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class LogicalStringComparer : StringComparer | |
{ | |
public static LogicalStringComparer LogicalOrdinal { get; } = new LogicalStringComparer(Ordinal); | |
public static LogicalStringComparer LogicalOrdinalIgnoreCase { get; } = new LogicalStringComparer(OrdinalIgnoreCase); | |
private readonly StringComparer _comparer; | |
public LogicalStringComparer(StringComparer comparer) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string Prettify(string json) | |
{ | |
var sb = new StringBuilder(json.Length * 2); | |
var indent = 0; | |
var startOfLine = false; | |
for (var i = 0; i < json.Length; ++i) | |
{ | |
var c = json[i]; | |
if (!char.IsWhiteSpace(c)) | |
{ |