C#

C#

Made by DeepSource

Use Guid.Empty to create an empty GUID CS-R1007

Anti-pattern
Critical
Autofix

new SomeClass() is the syntax to instantiate a class in C#. However, new Guid() does not generate a new GUID. It instead returns an empty GUID. If you intend to use an empty GUID, consider using Guid.Empty as it is more straightforward to comprehend. If you wish to generate a new usable GUID, consider using Guid.NewGuid().

Bad Practice

var emptyGuid = new Guid();

Recommended

var emptyGuid  = Guid.Empty;
var usableGuid = Guid.NewGuid();

Reference