@sopepos commented on Wed Jan 02 2019
There's no "switch" statement in example code of "Pattern matching with switch and is" section.
private static void ProvidesFormatInfo(object obj)
{
if (obj is IFormatProvider fmt)
Console.WriteLine($"{fmt} object");
else if (obj is null) {
Console.Write("A null object reference: ");
Console.WriteLine("Its use could result in a NullReferenceException");
}
else
Console.WriteLine($"Some object type without format information");
}
โ ์ด ์น์ ์ ํธ์งํ์ง ๋ง์ธ์. docs.microsoft.com โ GitHub ๋ฌธ์ ์ฐ๊ฒฐ์ ํ์ํฉ๋๋ค.
Hi team,
I'm moving this here since the suggestion is about the code
best regards
We should add a second sample here.
There also doesn't seem to be any use of the Discard in that example either.
I think "no switch" is not a problem with this example. The problem is that it is not related to the topic of article - discards.
Just noticed this as well. The Pattern matching with switch and is sample doesn't use discards at all.
I think this issue is fixed in https://github.com/dotnet/samples/pull/936
Closing, dotnet/samples#936 fixed this as well
Most helpful comment
I think this issue is fixed in https://github.com/dotnet/samples/pull/936