Esempio n. 1
0
 public static DatedFile[] Sort(DatedFile[] files)
 {
     // front to back - 1
     for (int i = 0; i < files.Length - 1; i++)
     {
         // front + 1 to back
         for (int j = i + 1; j < files.Length; j++)
         {
             if (files[i].Date < files[j].Date)
             {
                 // swap i with j, where i=1 and j=2
                 DatedFile file = files[j];
                 files[j] = files[i];
                 files[i] = file;
             }
         }
     }
     return(files);
 }
Esempio n. 2
0
		public static DatedFile[] Sort(DatedFile[] files)
		{
			// front to back - 1 
			for(int i = 0; i < files.Length - 1; i++)
			{
				// front + 1 to back
				for(int j = i + 1; j < files.Length; j++)
				{			
					if (files[i].Date < files[j].Date)
					{											 
						// swap i with j, where i=1 and j=2
						DatedFile file = files[j];
						files[j] = files[i];
						files[i] = file;
					}													
				}
			}
			return files;
		}