Last active
December 18, 2019 16:21
-
-
Save ansariabr/da84f6b70ffd92a3ddbc08280d42fbaf to your computer and use it in GitHub Desktop.
A wrapper on top of DateTimeOffset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct DateTimeOffsetWrapper | |
{ | |
private static DateTimeOffset? _dateTimeOffset; | |
public static DateTimeOffset Now => _dateTimeOffset ?? DateTimeOffset.Now; | |
/// <summary> | |
/// This method can be used to initialize our internal DateTimeOffset object to the desired date and time | |
/// </summary> | |
/// <param name="dateTimeOffset">Desired date and time</param> | |
public static void SetDateTimeOffset(DateTimeOffset dateTimeOffset) | |
{ | |
_dateTimeOffset = dateTimeOffset; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment