gpt4 book ai didi

c# - 属性 getter 中的逻辑

转载 作者:行者123 更新时间:2023-11-30 14:50:31 25 4
gpt4 key购买 nike

<分区>

对于属性 getter 来说,多少逻辑太多了?例如,我有如下代码:

        public double value
{
get
{
if (condition1
|| condition2
|| condition3
|| condition4)
{
_value = anotherValue;
}
return _value;
}
}

我读过很多帖子说属性中的代码不应该很昂贵。但是“昂贵”这个词对我来说有点模糊。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com