Removal of ToArray()

This commit is contained in:
Brett Hewitson 2021-12-16 00:21:23 +10:00
parent 9eb22da9e7
commit 9f5cf132f0
41 changed files with 184 additions and 189 deletions

View file

@ -173,13 +173,13 @@ namespace ServerManagerTool.Common.Model
if (property.GetValue(this) is IIniValuesCollection collection)
{
var values = SplitCollectionValues(kvPropertyValue, DELIMITER);
values = values.Where(v => !string.IsNullOrWhiteSpace(v)).ToArray();
var values = SplitCollectionValues(kvPropertyValue, DELIMITER)
.Where(v => !string.IsNullOrWhiteSpace(v));
if (attr?.ListValueWithinBrackets ?? false)
{
values = values.Select(v => v.Substring(1)).ToArray();
values = values.Select(v => v.Substring(0, v.Length - 1)).ToArray();
values = values.Select(v => v.Substring(1));
values = values.Select(v => v.Substring(0, v.Length - 1));
}
collection.FromIniValues(values);
}
@ -266,7 +266,7 @@ namespace ServerManagerTool.Common.Model
return result.ToString();
}
protected string[] SplitCollectionValues(string valueString, char delimiter)
protected IEnumerable<string> SplitCollectionValues(string valueString, char delimiter)
{
if (string.IsNullOrWhiteSpace(valueString))
return new string[0];
@ -306,7 +306,7 @@ namespace ServerManagerTool.Common.Model
result.Add(tempString.Substring(startIndex));
return result.ToArray();
return result;
}
public void Update(AggregateIniValue other)