using System; class Hoge { private string _helloWorld; private char _suffix = '!'; public string HelloWorld { get => _helloWorld; set => _helloWorld = value ?? throw new ArgumentNullException(); } public string TryGetHelloWorld(out string str) => str = (this.HelloWorld is string helloWorld) ? helloWorld : ""; public ref char GetSuffix() => ref _suffix; } class Program { public static void Main() { (string helloWorld, int, char suffix, double) HelloWorld() { var hoge = new Hoge() { HelloWorld = "Hello World" }; var suffix = hoge.GetSuffix(); switch (hoge) { case object hogeObj: { ((Hoge)hogeObj).TryGetHelloWorld(out var helloWorld); return (helloWorld, 114514, suffix, Math.PI); } } throw new Exception(); } var (h, _, s, _) = HelloWorld(); Console.WriteLine(h + s); } }