Esempio n. 1
0
        }         // proc WriteListCheckRange

        #endregion

        #region -- WriteListFetchEnum -----------------------------------------------------

        private void WriteListFetchEnum(XmlWriter xml, IDEListDescriptor descriptor, IEnumerator enumerator, int startAt, int count)
        {
            if (startAt < 0 || count < 0)
            {
                throw new ArgumentException("start oder count dürfen nicht negativ sein.");
            }

            // Überspringe die ersten
            while (startAt > 0)
            {
                if (!enumerator.MoveNext())
                {
                    break;
                }
                startAt--;
            }

            // Gib die Element aus
            while (count > 0)
            {
                if (!enumerator.MoveNext())
                {
                    break;
                }

                descriptor.WriteItem(new DEListItemWriter(xml), enumerator.Current);
                count--;
            }
        }         // func WriteListFetchEnum
Esempio n. 2
0
        }         // func GetListTypeString

        private static string GetListItemString(IDEListDescriptor descriptor, object item)
        {
            using (var s = new StringWriter())
                using (var x = XmlWriter.Create(s))
                {
                    descriptor.WriteItem(new DEListItemWriter(x), item);

                    x.Flush();
                    s.Flush();
                    return(s.GetStringBuilder().ToString());
                }
        }         // func GetListItemString
Esempio n. 3
0
        }         // proc WriteListFetchListTyped

        #endregion

        #region -- WriteListFetchList -----------------------------------------------------

        private void WriteListFetchList(XmlWriter xml, IDEListDescriptor descriptor, IList list, int startAt, int count)
        {
            WriteListCheckRange(xml, ref startAt, ref count, list.Count, false);

            if (count > 0)
            {
                var end = startAt + count;
                for (int i = startAt; i < end; i++)
                {
                    descriptor.WriteItem(new DEListItemWriter(xml), list[i]);
                }
            }
        }         // proc WriteListFetchList
Esempio n. 4
0
            }             // proc WriteList

            private static void WriteList <T>(IPropertyReadOnlyDictionary r, XmlWriter xml, IDEListDescriptor descriptor, IList <T> list, int startAt, int count)
            {
                WriteListCheckRange(xml, ref startAt, ref count, list.Count, false);

                if (count > 0)
                {
                    var end = startAt + count;
                    for (int i = startAt; i < end; i++)
                    {
                        descriptor.WriteItem(new DEListItemWriter(xml), (T)list[i]);
                    }
                }
            }             // proc WriteList
Esempio n. 5
0
            }             // proc WriteList

            private static void WriteList <T>(IPropertyReadOnlyDictionary r, XmlWriter xml, IDEListDescriptor descriptor, IDERangeEnumerable2 <T> list, int startAt, int count)
            {
                WriteListCheckRange(xml, ref startAt, ref count, list.Count, true);

                if (count > 0)
                {
                    using (var enumerator = list.GetEnumerator(startAt, count, r))
                    {
                        while (count > 0)
                        {
                            if (!enumerator.MoveNext())
                            {
                                break;
                            }

                            descriptor.WriteItem(new DEListItemWriter(xml), enumerator.Current);
                            count--;
                        }
                    }
                }
            }     // proc WriteList