Duplicate dates

  • Thread starter Thread starter Trond
  • Start date Start date
T

Trond

I have been trying to fig out how to build up an array with dates. When its
generated i want to be able to remove duplicate dates. The dates is
generated by FileInfo object that is scanning a folder for files.
Here is some code for that. In this case i am only using a variable not an
array.

_info = new FileInfo(_fileName);
base.Text = _info.LastWriteTime.ToShortDateString();

As i see it i must first generate the array with dates. Then create another
array an put the values from array 1 into it one by one. I tested with
StringCollection object. But i'm stuck. I kant fig out how to do it. Are
there someone that have some code that can show me how to remove duplicate
dates from my array?

Best regards
Trond
 
Why not check the array first before inserting a duplicate? If you are
using a hashtable you can use the .Contains() method to see if the item is
already there.
 
Thank you. I will try that. Would be fantastic if you added some code to
that comment, in case you have some. It is always easyer to learn by viewing
some code :-)
Best regards
Trond
 
Back
Top