您的问题似乎不完整,您是想询问关于C语言编程的某个具体问题吗?比如C语言的语法、编程技巧、项目开发等。请提供更具体的信息,这样我才能给出更准确的回答。

2026-03-26 23:321阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计363个文字,预计阅读时间需要2分钟。

您的问题似乎不完整,您是想询问关于C语言编程的某个具体问题吗?比如C语言的语法、编程技巧、项目开发等。请提供更具体的信息,这样我才能给出更准确的回答。

csharp// 创建字典System.Collections.DictionaryEntry dic=new System.Collections.DictionaryEntry(key1, value1);// 创建列表System.Collections.ArrayList list=new System.Collections.ArrayList();// 添加数据list.Add(1);// 添加更多数据list.Add(2);

您的问题似乎不完整,您是想询问关于C语言编程的某个具体问题吗?比如C语言的语法、编程技巧、项目开发等。请提供更具体的信息,这样我才能给出更准确的回答。

//Dictionary
System.Collections.DictionaryEntry dic=new System.Collections.DictionaryEntry("key1","value1");

//ArrayList
System.Collections.ArrayList list=new System.Collections.ArrayList();
list.Add(1);//添加数据
list.Add(2);
for(int i=0;i<list.Count;i++)
{
System.Console.WriteLine(list[i]);//取出数据
}

//HashTable
System.Collections.Hashtable table=new System.Collections.Hashtable();
table.Add("table1",1);//添加数据
table.Add("table2",2);
System.Collections.IDictionaryEnumerator d=table.GetEnumerator();//获取迭代器
while(d.MoveNext())
{
System.Console.WriteLine(d.Entry.Key);//通过迭代器获取数据
}
System.Console.WriteLine(table["table1"]);//直接读取数据

//Queue
System.Collections.Queue queue=new System.Collections.Queue();
queue.Enqueue(1);//入队
queue.Enqueue(2);

System.Console.WriteLine(queue.Peek());//Queue.Peek()方法,取出队顶数据但不出队
while(queue.Count>0)
{
System.Console.WriteLine(queue.Dequeue());//出队
}

//SortedList
System.Collections.SortedList list=new System.Collections.SortedList();
list.Add("key2",2);//添加数据
list.Add("key1",1);
for(int i=0;i<list.Count;i++)
{
//打印输出,可以看出数据被排序了
System.Console.WriteLine(list.GetKey(i));//获取关键字
}

//Stack
System.Collections.Stack stack=new System.Collections.Stack();
stack.Push(1);//入栈
stack.Push(2);

System.Console.WriteLine(stack.Peek());//Stack.Peek()方法,取出栈顶数据但不出栈
while(stack.Count>0)
{
System.Console.WriteLine(stack.Pop());//出栈
}

标签:范例

本文共计363个文字,预计阅读时间需要2分钟。

您的问题似乎不完整,您是想询问关于C语言编程的某个具体问题吗?比如C语言的语法、编程技巧、项目开发等。请提供更具体的信息,这样我才能给出更准确的回答。

csharp// 创建字典System.Collections.DictionaryEntry dic=new System.Collections.DictionaryEntry(key1, value1);// 创建列表System.Collections.ArrayList list=new System.Collections.ArrayList();// 添加数据list.Add(1);// 添加更多数据list.Add(2);

您的问题似乎不完整,您是想询问关于C语言编程的某个具体问题吗?比如C语言的语法、编程技巧、项目开发等。请提供更具体的信息,这样我才能给出更准确的回答。

//Dictionary
System.Collections.DictionaryEntry dic=new System.Collections.DictionaryEntry("key1","value1");

//ArrayList
System.Collections.ArrayList list=new System.Collections.ArrayList();
list.Add(1);//添加数据
list.Add(2);
for(int i=0;i<list.Count;i++)
{
System.Console.WriteLine(list[i]);//取出数据
}

//HashTable
System.Collections.Hashtable table=new System.Collections.Hashtable();
table.Add("table1",1);//添加数据
table.Add("table2",2);
System.Collections.IDictionaryEnumerator d=table.GetEnumerator();//获取迭代器
while(d.MoveNext())
{
System.Console.WriteLine(d.Entry.Key);//通过迭代器获取数据
}
System.Console.WriteLine(table["table1"]);//直接读取数据

//Queue
System.Collections.Queue queue=new System.Collections.Queue();
queue.Enqueue(1);//入队
queue.Enqueue(2);

System.Console.WriteLine(queue.Peek());//Queue.Peek()方法,取出队顶数据但不出队
while(queue.Count>0)
{
System.Console.WriteLine(queue.Dequeue());//出队
}

//SortedList
System.Collections.SortedList list=new System.Collections.SortedList();
list.Add("key2",2);//添加数据
list.Add("key1",1);
for(int i=0;i<list.Count;i++)
{
//打印输出,可以看出数据被排序了
System.Console.WriteLine(list.GetKey(i));//获取关键字
}

//Stack
System.Collections.Stack stack=new System.Collections.Stack();
stack.Push(1);//入栈
stack.Push(2);

System.Console.WriteLine(stack.Peek());//Stack.Peek()方法,取出栈顶数据但不出栈
while(stack.Count>0)
{
System.Console.WriteLine(stack.Pop());//出栈
}

标签:范例