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

📄 sortdelegate.cs

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

namespace DelegateSample
{
	/// <summary>
	/// SortDelegate 的摘要说明。
	/// </summary>
	/// 

	//public delegate bool Comparator(int i,int j);

	public class SortDelegate
	{
		public delegate bool Comparator(int i,int j);
		
		public static void SortArray(int[] array,Comparator com)
		{
			for(int i=0;i<array.Length-1;i++)
			{
				for(int j=i+1;j<array.Length;j++)
				{
					if(com(array[i],array[j]))	
					{
						Swap(ref array[i],ref array[j]);
					}
				}
			}

		}

		public static void Swap(ref int i,ref int j)
		{
			int temp=i;
			i=j;
			j=temp;
		}

	}
}

⌨️ 快捷键说明

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