ufcpp/UfcppSample

nameof accessing instance members

Closed this issue · 1 comments

ufcpp commented

まあ、「12の新機能」ページの最後の方に「その他」作って、そこだけに書けばいいかな。
個別のページに書くほどのものじゃなさげ。

class A1
{
    public string? Instance { get; }

    // これは元から行けた。
    public string InstanceM() => nameof(Instance.Length);
    public static string StaticM1() => nameof(String.Length);
    public static string StaticM2() => nameof(Instance);

    // これが今までダメだったらしい。
    // (誰得かはわからない。)
    public static string StaticM() => nameof(Instance.Length);
}