Neerav Sachdeva

Neerav Sachdeva

  • NA
  • 33
  • 81.4k

.NET C# application

Nov 25 2010 7:12 AM

I want to run athread at a particular time.I am passing one date and i am comparing it by system date .I want that
if it matches with systam date then my thread dhould thred but it is not doing so can anyone help me on that:-
Here is my sample code
 
public
static void Main()
{
DateTime date1 = new DateTime(2010, 11, 25, 12, 50, 0);
DateTime date2 = new DateTime(2010,11, 24, 19, 23, 0);
//DateTime current = DateTime.Now;

string relationship;
while (true)
{
//DateTime current = DateTime.Now;
int result = DateTime.Compare( date1,DateTime.Now);
if (result < 0)
relationship =
"is earlier than";
else if (result == 0)
{
relationship =
"is the same time as";
//here i want to start my thread
break;
}
else
relationship =
"is later than";
}
Console.WriteLine("equal time ");
//here it is not showing this result
Console.ReadLine();
 
 
}

Answers (1)