(no title)
paphillips | 3 years ago
For example:
public void CheckIsTrue(bool value, [CallerArgumentExpression("value")] string? expression = null)
{
if (!value)
{
Debug.WriteLine($"Failed: '{expression}'");
}
}
So if you call like this: CheckIsTrue(foo != bar && baz == true), when the value is false it prints "Failed: 'foo != bar && baz == true'".[1] https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... [2] https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
No comments yet.