Using Constants.KeyDelimiter instead of ":"
This commit is contained in:
Родитель
3125ec94c5
Коммит
017b7ba112
|
@ -110,7 +110,7 @@ namespace Microsoft.Framework.Configuration.Ini
|
|||
if (line[0] == '[' && line[line.Length - 1] == ']')
|
||||
{
|
||||
// remove the brackets
|
||||
sectionPrefix = line.Substring(1, line.Length - 2) + ":";
|
||||
sectionPrefix = line.Substring(1, line.Length - 2) + Constants.KeyDelimiter;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,13 +101,13 @@ namespace Microsoft.Framework.Configuration.Json
|
|||
private void EnterContext(string context)
|
||||
{
|
||||
_context.Push(context);
|
||||
_currentPath = string.Join(":", _context.Reverse());
|
||||
_currentPath = string.Join(Constants.KeyDelimiter, _context.Reverse());
|
||||
}
|
||||
|
||||
private void ExitContext()
|
||||
{
|
||||
_context.Pop();
|
||||
_currentPath = string.Join(":", _context.Reverse());
|
||||
_currentPath = string.Join(Constants.KeyDelimiter, _context.Reverse());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ namespace Microsoft.Framework.Configuration
|
|||
{
|
||||
public class ConfigurationKeyComparer : IComparer<string>
|
||||
{
|
||||
private const char Separator = ':';
|
||||
|
||||
private static readonly string[] _keyDelimiterArray = new[] { Constants.KeyDelimiter };
|
||||
|
||||
public static ConfigurationKeyComparer Instance { get; } = new ConfigurationKeyComparer();
|
||||
|
||||
public int Compare(string x, string y)
|
||||
{
|
||||
var xParts = x?.Split(Separator) ?? new string[0];
|
||||
var yParts = y?.Split(Separator) ?? new string[0];
|
||||
var xParts = x?.Split(_keyDelimiterArray, StringSplitOptions.RemoveEmptyEntries) ?? new string[0];
|
||||
var yParts = y?.Split(_keyDelimiterArray, StringSplitOptions.RemoveEmptyEntries) ?? new string[0];
|
||||
|
||||
// Compare each part until we get two parts that are not equal
|
||||
for (int i = 0; i < Math.Min(xParts.Length, yParts.Length); i++)
|
||||
|
|
Загрузка…
Ссылка в новой задаче