Roadkill.Core.Mvc.ViewModels.PageViewModel.ParseTags C# (CSharp) Méthode

ParseTags() public static méthode

Takes a string of tags: "tagone,tagtwo,tag3 " and returns a list.
public static ParseTags ( string tags ) : IEnumerable
tags string
Résultat IEnumerable
        public static IEnumerable<string> ParseTags(string tags)
        {
            List<string> tagList = new List<string>();
            char delimiter = ',';

            if (!string.IsNullOrEmpty(tags))
            {
                // For the legacy tag seperator format
                if (tags.IndexOf(";") != -1)
                    delimiter = ';';

                if (tags.IndexOf(delimiter) != -1)
                {
                    string[] parts = tags.Split(delimiter);
                    foreach (string item in parts)
                    {
                        if (item != "," && !string.IsNullOrWhiteSpace(item))
                            tagList.Add(item.Trim());
                    }
                }
                else
                {
                    tagList.Add(tags.TrimEnd());
                }
            }

            return tagList;
        }