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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sorting Array using Icomparable 6
FileInfo by month 9
Dates 4
Canceling out of a delegate or IComparable 2
Readonly array elements 6
PHP lottery number generator 0
Sender object in event? 10
Getting FileInfo[] 2

Back
Top