是否可以創建一個指向DateTime對象的C#指針?我試圖做到這一點:是否有可能爲DateTime對象創建C#'指針'?
DateTime Event1 = DateTime.Now;
DateTime Event2 = DateTime.Now.AddYears(10);
DateTime EventPointer; // A Pointer?
if (something)
{
EventPointer = Event1;
}
else
{
EventPointer = Event2;
}
EventPointer.DoSomething? // Something that would change the value of Event1/2 variable.
這就是我一直在尋找的。我以某種方式假定DateTime是一個類,而不是一個結構。 – Jeff