我想更改此代码:
public string Height
{
get => (string)GetValue(HeightProperty);
set => SetValue(HeightProperty, value);
}
如何更改代码以不使用=>
和在例如get和set发生的事情前后添加更多的代码行?
您可以在get
和之后打开代码块set
:
public string Height
{
get {
// do something
return (string)GetValue(HeightProperty);
}
set {
// validations, etc...
SetValue(HeightProperty, value);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句