Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 450 Bytes

ComplexObjectDestructuringProblem.md

File metadata and controls

29 lines (21 loc) · 450 Bytes

Complex objects with default ToString() implementation probably need to be destructured

Noncompliant Code Example:

class User
{
    public int Age { get; set; }
}

...

Log.Information("The user is {MyUser}", new User());

Compliant Solution:

class User
{
    public int Age { get; set; }
}

...

Log.Information("The user is {@MyUser}", new User());

// or

Log.Information("The user is {$MyUser}", new User());