Try C#7’s Pattern Matching.
Using your example:
if (new StringBuilder("test") is var sb && sb != null) {
Console.WriteLine(sb);
}
Try C#7’s Pattern Matching.
Using your example:
if (new StringBuilder("test") is var sb && sb != null) {
Console.WriteLine(sb);
}