Skip to content

Commit

Permalink
The lock statement (csharp-13)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimatay committed Jun 20, 2024
1 parent f6896e8 commit d33075a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TheLockStatement/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public static Singleton Instance
{
if (_lock)
{
if (instance == null)
// Logical patterns Csharp-9
// https://devblogs.microsoft.com/dotnet/c-9-0-on-the-record/#logical-patterns
if (instance is not null)
{
instance = new();
instance._currentDateTime = DateTime.Now;
Expand Down

0 comments on commit d33075a

Please sign in to comment.