 |
|
 |
| |
Developer on focus
Anton Zamov is a dipl. engineer with more than 6 years of active professional
experience and many awards ...
read more>>
|
|
 |
 |
 |
|
 |
|
 |
| |
|
How to work with Comparer in order to sort files by date?
|
using System;
using System.Collections;
using System.IO;
namespace InfoSystem
{
/// <summary>
/// This class is created by Anton Zamov
/// For more information about Anton Zamov
/// and a lot of other useful examples
/// please visit http://zamov.online.fr
/// You may use and redistribute this code as
/// long as you keep this message intact.
/// </summary>
public class FilesDateComparer: IComparer
{
public int Compare (object x, object y)
{
int iResult;
FileInfo oFileX=(FileInfo)x;
FileInfo oFileY=(FileInfo)y;
if(oFileX.LastWriteTime==oFileY.LastWriteTime)
{
iResult=0;
}
else
if(oFileX.LastWriteTime>oFileY.LastWriteTime)
{
iResult=1;
}
else
{
iResult=-1;
}
return iResult;
}
}
}
|
About the author of this programming example or tutorial:
Anton Zamov is a software engineer with more than6 years
of active experience in web and software development and design.
Anton Zamov has extensive experience and broad knowledgebase
in C# and JAVA programming and has created a lot of
running e-commerce systems, portals and content management
systems using PHP and other web development technologies.
For more information about Anton Zamov, you may visit the personal web site of
Anton Zamov.
|
|
|
 |
 |
 |
|
|