using System;
using System.IO;
public class Program
{
public long GetLengthA(object o)
switch (o)
case Stream x:
return x.Length;
}
case Array x: // <-- this is allowed
return 0;
public long GetLengthB(object o)
if (o is Stream x)
else if (o is Array y)
return y.Length;
public static void Main()
Console.WriteLine("Hello World");