本文整理汇总了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());
}
示例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();
}
示例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;
}
}
}
示例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;
}
示例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();
}