예제 #1
0
        public static Dictionary <string, string> Parse(this AssemblyDescriptionAttribute source, char[] partDelimeters, char[] itemDelimeters)
        {
            var sourceValue = source.Value();

            if (sourceValue.IsEmpty())
            {
                return(new Dictionary <string, string>());
            }

            return(sourceValue.Split(partDelimeters, StringSplitOptions.RemoveEmptyEntries)
                   .Select(
                       part => part.Trim()
                       )
                   .Select(
                       part => part.Split(itemDelimeters, StringSplitOptions.RemoveEmptyEntries)
                       )
                   .Where(
                       partItems => partItems.Length == 2
                       )
                   .ToDictionary(
                       partItems => partItems[0].Trim(),
                       partItems => partItems[1].Trim()
                       ));
        }