Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

C# How to convert a Dictionary key to a List.

$
0
0

Hi:


I have a Dictionary<string, string>.  The first string  (the key) are dates as a string.  I need to convert the key as a string to a List<DateTime>.  I want to bold the calendar with the dates in the List<DateTime>.


private void BoldCalendar(System.Windows.Forms.MonthCalendar calendar, Dictionary<string, string> dictionary)
{
            List<DateTime> listDates = new List<DateTime>();

            foreach (KeyValuePair<string, string> date in dictionary)
            {

                listDates.Add(Convert.ToDateTime(date.Key. ?????);
              
                calendar.AddBoldedDate(listDates);      // not sure about this line either
            }
}

According to this site:

http://msdn.microsoft.com/en-us/library/aa983564(v=vs.71).aspx

The DateTime values have to be in this format, DateTime date = new DateTime(2001, 6, 17);

Would that cause a problem if they were not in that format?

Thank you very much for your time and expertise.

Sincerely,

Bosco Dog


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>