ch1_12.cs

来自「《c#技术内幕代码》」· CS 代码 · 共 37 行

CS
37
字号
using System;
using System.Collections;

class CH1_12 {
   public static void Main() 
   {
	Dictionary dict = new Dictionary();
	
	dict.Add(1, "C++");
	dict.Add(2, "C");
	dict.Add(3, "Ada");
	dict.Add(4, "APL");
	dict.Add(5, "VB");
	dict.Add(6, "C#");
	dict.Add(7, "Java");
	dict.Add(8, "FORTRAN");
	
	// Print out the list
	Console.WriteLine("Before Deleting Anything");
	foreach ( DictionaryEntry de in dict )
	{
		Console.WriteLine( "Entry Key {0} Value {1}", de.Key, de.Value );
	}
	
	dict.Remove( 4 );
	dict.Remove( 7 );
	
	Console.WriteLine("\nAfter Deletions");
	foreach ( DictionaryEntry de in dict  )
	{
		Console.WriteLine( "Entry Key {0} Value {1}", de.Key, de.Value );
	}
	
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?