Show / Hide Table of Contents

MSDN.WhiteKnight - Stack Overflow answers

Ответ на "С# Имя из названия переменной гетера/сеттера"

Answer 931197

Link

Решение для .NET 4.5+:

public static string GetPropertyName([System.Runtime.CompilerServices.CallerMemberName] String propertyName = "")
{
    return propertyName;
}

public static Object TestName
{
    get {
        return X(GetPropertyName());
    }
}

Content is retrieved from StackExchange API.

Auto-generated by ruso-archive tools.

Back to top Stack Overflow answers (published from sources in GitHub repository). Copyright (c) 2020, MSDN.WhiteKnight. Content licensed under BSD 3-Clause License.
Generated by DocFX