我了解如何创建 getter 和 setter
public myClass
{
public int myVal { get; set; }
// more stuff
}
但我不明白以后如何调用它。
public myOtherClass
{
public myOtherClass()
{
myClass localMyClass = new myClass();
localMyClass.???set??? = 42;
// Intelisense doesn't seem to give any obvious options after I enter
// the period.
}
}
我应该如何在 localMyClass 中设置 myVal 的值?