本文整理汇总了C#中LinkedList.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# LinkedList.IsEmpty方法的具体用法?C# LinkedList.IsEmpty怎么用?C# LinkedList.IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedList
的用法示例。
在下文中一共展示了LinkedList.IsEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
try
{
LinkedList list = new LinkedList();
Console.WriteLine("It is {0} that this list in empty", list.IsEmpty());
list.Insert("Happy days");
list.Insert("Pie in the sky");
list.Insert("Trouble in River City");
Console.WriteLine("The original list is:");
list.Display();
list.Reset();
list.Advance();
Console.WriteLine("The current list element is {0}", list.GetData());
list.Remove();
Console.WriteLine("The list, after removing the current element, is:");
list.Display();
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.WriteLine("Hit any key to exit");
Console.ReadLine();
}
示例2: AddToHistory
private static void AddToHistory(LinkedList<ViewModel> history, ViewModel viewModel)
{
if (viewModel == null)
{
throw new ArgumentNullException("viewModel");
}
if (history.Count >= HistorySize)
{
history.RemoveLast();
}
if (history.IsEmpty())
{
history.AddFirst(viewModel);
}
else if (history.First.Value != viewModel)
{
history.AddFirst(viewModel);
}
}
示例3: Iterator
internal Iterator(LinkedList list, int index)
{
m_list = list;
if (m_list.IsEmpty()) {
m_link = null;
}
if (index > m_list.Count)
throw new LinkedListException("Index out of list size");
if (index == m_list.Count) {
m_link = null;
} else {
m_link = m_list.m_bottom;
while ((index--) > 0) {
m_link = m_link.next;
}
}
}
示例4: Iterator
internal Iterator(LinkedList list, int index) {
m_list = list;
if (m_list.IsEmpty()) {
m_link = null;
}
if (index > m_list.Count)
throw new LinkedListException("Попытка обращения к элементу за пределом списка");
if (index == m_list.Count) {
m_link = null;
} else {
m_link = m_list.m_bottom;
while ((index--) > 0) {
m_link = m_link.next;
}
}
}