?: ?? Operators Instead Of IF|ELSE

前端 未结 9 1654
粉色の甜心
粉色の甜心 2020-11-28 02:09
public string Source
{
    get
    {
        /*
        if ( Source == null ){
            return string . Empty;
        } else {
            return Source;
                


        
9条回答
  •  佛祖请我去吃肉
    2020-11-28 02:35

    If you are concerned with the verbosity of your code I would write this rather than trying to abuse expressions.

    if (Source == value) return;
    Source = value;
    RaisePropertyChanged("Source");
    

提交回复
热议问题