Reputation: 31
How do I pass in the arguments for DateTime so it corresponds to the required formal parameter? Int, string and double are NO problem, but this is giving me true headache.
class Activity
{
public int Id { get; set; }
public int MinAge { get; set; }
public int MaxAge { get; set; }
public static DateTime StartTime { get; private set; }
public static DateTime EndTime { get; private set; }
public Activity(int id, int minAge, int maxAge, DateTime startTime, DateTime endTime)
{
Id = id;
MinAge = minAge;
MaxAge = maxAge;
StartTime = startTime;
EndTime = endTime;
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Activity ak1 = new Activity(1, 15, 21, ?, ?);
}
}
Upvotes: 2
Views: 307
Reputation: 38134
It is necessary to send parameter of type DateTime
. So you can send DateTime.Now
or if you have date, then just use overloading of constructor like this new DateTime(2008, 5, 1, 8, 30, 52)
Upvotes: 2