結果

問題 No.9000 Hello World! (テスト用)
ユーザー くれちー
提出日時 2017-10-09 12:47:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 853 bytes
コンパイル時間 4,172 ms
コンパイル使用メモリ 112,000 KB
実行使用メモリ 17,024 KB
最終ジャッジ日時 2024-12-25 15:05:20
合計ジャッジ時間 1,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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()
    {
        var hoge = new Hoge() { HelloWorld = "Hello World" };
        var suffix = hoge.GetSuffix();

        switch (hoge)
        {
            case object hogeObj:
            {
                ((Hoge)hogeObj).TryGetHelloWorld(out var helloWorld);
                Console.Write(helloWorld);
                Console.Write(suffix);
                break;
            }
        }
    }
}
0