Shameer Ali Baig Shameer Ali Baig -4 years ago 254
C# Question

List of DateTime Array in c#

I am trying to generate a list with set of array's having 2 dates per array.

I googled to find the logic in last two days, i could not figured out it,yet.

can anyone give me some idea and code snippet example.

Answer Source

@shameer: Are you looking for this?

List<DateTime[]> list = new List<DateTime[]>() { new[] { DateTime.Now, DateTime.Now }, new[] { DateTime.Today, DateTime.UtcNow } };

List<string[]> list = new List<string[]>() { new[] { "3 / 24 / 2017 2:09:30 AM", "3 / 25 / 2017 2:09:30 AM" }, new[] { DateTime.Now.ToString(), DateTime.UtcNow.ToString() } };

(or)in simple understanding

List<DateTime[]> list = new List<DateTime[]>();
        DateTime[] array1 = new[] { DateTime.Now, DateTime.Now };
        DateTime[] array2 = new[] { DateTime.Today, DateTime.UtcNow };
        list.Add(array1);
        list.Add(array2);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download