📄 ch4_03.cs
字号:
using System;
using System.Collections;
class CH4_3
{
public static void Main()
{
// First, an array of integers
int[] arrayOfInt = { 1, 2,3, 4, 5 };
foreach ( int i in arrayOfInt )
{
Console.WriteLine("Int {0}", i );
}
// Now, how about an array of strings?
string[] arrayOfStr = { "Hello", "Goodbye", "Why me?" };
foreach ( string s in arrayOfStr )
{
Console.WriteLine("String {0}", s );
}
// Finally, let's look at a dictionary collection
Dictionary d = new Dictionary(10);
d.Add( 100, "Science");
d.Add( 200, "Math");
d.Add( 300, "English");
d.Add( 400, "History");
d.Add( 500, "Gym");
foreach ( DictionaryEntry de in d )
{
Console.WriteLine( "Entry Key {0} Value {1}", de.Key, de.Value );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -