BExIS.Ddm.Providers.DummyProvider.Helpers.MetadataReader.GetAllValuesAsListDistinct C# (CSharp) Метод

GetAllValuesAsListDistinct() публичный статический Метод

public static GetAllValuesAsListDistinct ( List metadataList ) : IEnumerable
metadataList List
Результат IEnumerable
        public static IEnumerable<TextValue> GetAllValuesAsListDistinct(List<Metadata> metadataList)
        {
            List<TextValue> l = new List<TextValue>();

            // gehe alle Metadaten druch
            foreach (Metadata m in metadataList)
            {
                // gehe alle Values in Metadata durch
                foreach (string s in (m.GetAllValuesAsList()))
                {

                    //split strings to single words
                    Array a = s.Split(new Char[] { ' ' });
                    if (a.Length > 1)
                    {
                        foreach (string astring in a)
                        {
                            bool isIn = false;
                            // prüfe ob string schon in List
                            foreach (TextValue s2 in l)
                            {
                                if (astring == s2.Value) isIn = true;
                            }

                            if (isIn == false) {
                                //jedes wort wird eingefügt
                                TextValue tv = new TextValue();
                                tv.Name = astring;
                                tv.Value = astring;
                                l.Add(tv);

                            };
                            //kompletter string wird eingefügt

                        }

                    }

                       bool isInList = false;
                       // prüfe ob string schon in List
                       foreach (TextValue s2 in l)
                       {
                           if (s == s2.Value) isInList = true;
                       }

                       if (isInList == false) {
                           TextValue tv = new TextValue();
                           tv.Name = s;
                           tv.Value = s;
                           l.Add(tv);

                       }

                }
            }

            return l;
        }