⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 这是.net2005学习不可缺少的教程
💻 CS
字号:
using System;

namespace DelegateSample
{
	/// <summary>
	/// Class1 的摘要说明。
	/// </summary>
	class Class1
	{
		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			//
			// TODO: 在此处添加代码以启动应用程序
			//

			int type=Int32.Parse(Console.ReadLine());


			int[] array=new int[10];
			System.Random r=new Random();
			for(int i=0;i<array.Length;i++)
			{
				array[i]=r.Next(1,100);
			}
			printArray(array);
			
			SortDelegate.Comparator com;
			if(type==0)
			{
				com=new DelegateSample.SortDelegate.Comparator(AES);
			}
			else
			{
				com=new DelegateSample.SortDelegate.Comparator(DESC);
			}
			
			if(com!=null)
			{
				SortDelegate.SortArray(array,com);
			}
			
			
			printArray(array);

			Console.WriteLine(com.Method);

		}

		static bool AES(int i,int j)
		{
			return i<j;
		}

		static bool DESC(int i,int j)
		{
			return i>j;
		}

		static void printArray(int[] array)
		{
			foreach(int i in array)
			{
				Console.Write("{0}\t",i);
			}
		}
	}
}

⌨️ 快捷键说明

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