当前位置: 首页>>代码示例>>C#>>正文


C# ObservableCollection.GetEnumerator方法代码示例

本文整理汇总了C#中System.Collections.ObservableCollection.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.GetEnumerator方法的具体用法?C# ObservableCollection.GetEnumerator怎么用?C# ObservableCollection.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.ObservableCollection的用法示例。


在下文中一共展示了ObservableCollection.GetEnumerator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_ObservableCollection_Enumerator

 public void Test_ObservableCollection_Enumerator()
 {
     var list = new ObservableCollection<int>() { 4, 5, 6 };
     Assert.NotNull(list.GetEnumerator());
     var enumerable = list as IEnumerable;
     Assert.NotNull(enumerable);
     Assert.NotNull(enumerable.GetEnumerator());
 }
开发者ID:fs7744,项目名称:ObjectValidator,代码行数:8,代码来源:ObservableCollection_Test.cs

示例2: GetEnumeratorTest

        public static void GetEnumeratorTest()
        {
            Guid[] anArray = { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
            ObservableCollection<Guid> col = new ObservableCollection<Guid>((IEnumerable<Guid>)anArray);

            int i = 0;
            IEnumerator<Guid> e;
            for (e = col.GetEnumerator(); e.MoveNext(); ++i)
            {
                Assert.Equal(anArray[i], e.Current);
            }
            Assert.Equal(col.Count, i);
            e.Dispose();
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:14,代码来源:ObservableCollection_MethodsTest.cs

示例3: SendJournalList

        public bool SendJournalList()
        {
            lock (this)
            {
                try
                {

                    var l1 = JournalData.OrderBy(st => st.ID).ToList();
                    ObservableCollection<JournalContentData> d = new ObservableCollection<JournalContentData>(l1);
                    IEnumerator clientEnumerator = d.GetEnumerator();
                    StringBuilder str = new StringBuilder();
                    int count = 0;
                    while (clientEnumerator.MoveNext())
                    {
                        JournalContentData entry = (JournalContentData)clientEnumerator.Current;
                        if (entry.ID > 0)
                        {
                            str.Append(entry.ID + "-" + entry.ModifyDate + "-" + entry.Date + ";");
                            count++;
                            if (count == 10)
                            {
                                ResponsePacket pck = new OETS.Shared.ResponsePacket(Client.Instance.User, "SSocketServer",
                                    new Smc(Smc.ServiceProviderEnum.TripleDES).Encrypt(str.ToString()));
                                Client.Instance.SendCommand(Client.Instance.ServerIp, OpcoDes.CMSG_GETTING_JOURNAL, pck.GetType().FullName, pck);
                                count = 0;
                                str.Remove(0, str.Length);
                            }
                        }
                    }
                    if (str.Length >= 0)
                    {
                        ResponsePacket pck = new ResponsePacket(Client.Instance.User, "SSocketServer",
                                    new Smc(Smc.ServiceProviderEnum.TripleDES).Encrypt(str.ToString()));
                        Client.Instance.SendCommand(Client.Instance.ServerIp, OpcoDes.CMSG_GETTING_JOURNAL, pck.GetType().FullName, pck);
                        count = 0;
                        str.Remove(0, str.Length);
                    }
                    Trace.Write("[OETS.Client] [SendJournalList] All sended!");
                    return true;
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.Message);
                    return false;
                }
            }
        }
开发者ID:morz,项目名称:OETS.Journal,代码行数:47,代码来源:JournalManagerC.cs

示例4: SendJournalIds

 public bool SendJournalIds()
 {
     var l1 = JournalData.OrderBy(st => st.ID).ToList();
     ObservableCollection<JournalContentData> d = new ObservableCollection<JournalContentData>(l1);
     IEnumerator clientEnumerator = d.GetEnumerator();
     StringBuilder str = new StringBuilder();
     while (clientEnumerator.MoveNext())
     {
         //DictionaryEntry data = (DictionaryEntry)clientEnumerator.Current;
         JournalContentData entry = (JournalContentData)clientEnumerator.Current;
         if (entry.ID > 0)
             str.Append(entry.ID + ";");
     }
     if (str.Length >= 0)
     {
         ResponsePacket pck = new ResponsePacket(Client.Instance.User, "SSocketServer",
                     new Smc(Smc.ServiceProviderEnum.TripleDES).Encrypt(str.ToString()));
         Client.Instance.SendCommand(Client.Instance.ServerIp, OpcoDes.CMSG_GETTING_JOURNAL_2,
             pck.GetType().FullName, pck);
     }
     Trace.Write("[OETS.Client] [SendJournalIds] All sended!");
     return true;
 }
开发者ID:morz,项目名称:OETS.Journal,代码行数:23,代码来源:JournalManagerC.cs

示例5: GetJournalEntriesIds

 public String GetJournalEntriesIds()
 {
     var l1 = JournalData.OrderBy(st => st.ID).ToList();
     ObservableCollection<JournalContentData> d = new ObservableCollection<JournalContentData>(l1);
     IEnumerator jeEnumerator = d.GetEnumerator();
     StringBuilder str = new StringBuilder();
     while (jeEnumerator.MoveNext())
     {
         JournalContentData entry = (JournalContentData)jeEnumerator.Current;
         if (entry.ID > 0)
             str.Append(entry.ID + "-" + entry.ModifyDate + "-" + entry.Date + ";");
     }
     return str.ToString();
 }
开发者ID:morz,项目名称:OETS.Journal,代码行数:14,代码来源:JournalManagerC.cs


注:本文中的System.Collections.ObservableCollection.GetEnumerator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。