.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
601 B

using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class PatternMatching
{
public bool SimpleTypePattern(object x)
{
Use(x is string y);
if (x is string z)
{
Console.WriteLine(z);
}
return x is string w;
}
public bool SimpleTypePatternWithShortcircuit(object x)
{
Use(F() && x is string y && y.Contains("a"));
if (F() && x is string z && z.Contains("a"))
{
Console.WriteLine(z);
}
return F() && x is string w && w.Contains("a");
}
private bool F()
{
return true;
}
private void Use(bool x)
{
}
}
}