Ejemplo n.º 1
0
 private static string[] FromString(string[] items)
 {
     if (items == null)
     {
         return(allValue);
     }
     if (items.Length == 0)
     {
         return(unusedValue);
     }
     if (items.Contains(allString, StringComparer.CurrentCultureIgnoreCase) == true || items.Contains("Both", StringComparer.CurrentCultureIgnoreCase) == true)
     {
         return(allValue);
     }
     else if (items.Contains(unusedString, StringComparer.CurrentCultureIgnoreCase) == true)
     {
         return(unusedValue);
     }
     foreach (var item in items)
     {
         IdentifierValidator.Validate(item.Trim());
     }
     return(items.Select(item => item.Trim())
            .Where(item => string.IsNullOrEmpty(item) == false)
            .Distinct(StringComparer.CurrentCultureIgnoreCase)
            .OrderBy(item => item.ToLower())
            .ToArray());
 }
Ejemplo n.º 2
0
        private static string[] FromString(string value)
        {
            if (value == null)
            {
                return(allValue);
            }
            if (value.Trim() == string.Empty)
            {
                return(unusedValue);
            }
            var items = value.Split(new char[] { Separator }, StringSplitOptions.RemoveEmptyEntries);

            if (items.Contains(allString, StringComparer.CurrentCultureIgnoreCase) == true || items.Contains("Both", StringComparer.CurrentCultureIgnoreCase) == true)
            {
                return(allValue);
            }
            else if (items.Contains(unusedString, StringComparer.CurrentCultureIgnoreCase) == true)
            {
                return(unusedValue);
            }
            foreach (var item in items)
            {
                IdentifierValidator.Validate(item.Trim());
            }
            return(items.Select(item => item.Trim())
                   .Distinct(StringComparer.CurrentCultureIgnoreCase)
                   .OrderBy(item => item.ToLower())
                   .ToArray());
        }