I'm trying to convert a timestamp to DateTime object in C# interactive using DateTime.UnixEpoch.
I have no problem doing it in my application code, but I can't get access to DateTime.UnixEpoch in C# Interactive.
I managed to convert a timestamp using suggestion from this StackOverflow post. It works in C# interactive just fine.
Now I'm curious why does DateTime.UnixEpoch accessable in my regular code and does not in my C# interactive envinroment.
I'm using Visual Studio 2022 17.7.3 and my project targeting .NET 7.0
Here is my code in C# interactive:
> double timeStamp = 1693620016;
. DateTime dateTime = DateTime.UnixEpoch;
. dateTime = dateTime.AddSeconds(timeStamp);
. Console.WriteLine(dateTime.Date);
Here is the Output:
(2,30): error CS0117: 'DateTime' does not contain a definition for 'UnixEpoch'