Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADIR and ASORT for .NET ?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01020162
Message ID:
01021064
Vues:
25
In all cases it is FOR loop that should go through ALL the files. Therefore I am looking for the SORT by date approach, then I would use WHILE loop instead.

>Yuri,
>Have you done any testing to find out what part of the code that is "slow". I don't like "old" VB6 functions that you can import in VB.NET so I figured I would write a little code myself to test (again it seems pretty quick but I don't have that many files). Here is the code I used (keep in mind it has no error handling and no error checking (it took me about 10 minutes to write (I got interupted by a phone call <s>)))
>
>
>private void button6_Click(object sender, System.EventArgs e)
>		{
>			System.Collections.Specialized.StringCollection myFileCollection = new System.Collections.Specialized.StringCollection();
>			string myPath = @"c:\it\";
>			string myFileName = "*.*";
>
>			foreach (string myFile in System.IO.Directory.GetFiles(myPath, myFileName))
>			{
>				myFileCollection.Add(myFile);
>			}
>
>			MessageBox.Show(myFileCollection.Count.ToString());
>
>			foreach(string myFile in myFileCollection)
>			{
>				MessageBox.Show(this.myDataDiff(System.IO.File.GetLastWriteTime(myFile), System.DateTime.Now).ToString());
>			}
>		
>
>		}
>
>		private long myDataDiff(System.DateTime date1,System.DateTime date2)
>		{
>			long TicksPerDay = 864000000000;
>			long diff = date2.Ticks - date1.Ticks;
>			long days = diff/TicksPerDay;
>
>			return days;
>		}
>
>
>Hope this helps.
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform