📜  c# on variable change property get set - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:39.631000             🧑  作者: Mango

代码示例1
public int MyProperty
{
    get { return _myProperty; }
    set
    {
        _myProperty = value;
        if (_myProperty == 1)
        {
            // DO SOMETHING HERE
        }
    }
}

private int _myProperty;