diff --git a/src/ConfigParser.cs b/src/ConfigParser.cs index 748a985..8d3ae98 100644 --- a/src/ConfigParser.cs +++ b/src/ConfigParser.cs @@ -223,7 +223,7 @@ public virtual byte[] GetValue(string sectionName, string keyName, byte[] defaul /// The default array value. /// /// - public virtual string[] GetValue(string sectionName, string keyName, string[] defaultValue = null) + public virtual string[] GetValue(string sectionName, string keyName, string[] defaultValue) { var arrayRaw = GetRawValue(sectionName, keyName, string.Empty); if (string.IsNullOrWhiteSpace(arrayRaw)) @@ -244,6 +244,18 @@ public virtual string[] GetValue(string sectionName, string keyName, string[] de .ToArray(); } + /// + /// Gets the array value. + /// + /// Name of the section. + /// Name of the key. + /// The default value. + /// + public virtual string[] GetArrayValue(string sectionName, string keyName, string[] defaultValue = null) + { + return GetValue(sectionName, keyName, defaultValue); + } + /// /// Checks if value the is an array. /// @@ -256,8 +268,8 @@ public virtual bool ValueIsArray(string sectionName, string keyName) if (string.IsNullOrWhiteSpace(arrayRaw)) return false; - var values = arrayRaw.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); - return values.Any(); + var values = arrayRaw.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + return values.Any() && string.IsNullOrWhiteSpace(values.First()); } #endregion