0

I have a viewmodel with the following two fields:

public bool IsMobile {get; set;}
public bool? AcceptSms {get; set;}

If IsMobile is set to true, I need to require a value for AcceptSms, not null. I cant figure out the structure to use the get or set function to require value.

Something like below is what I think I need ...

public bool? AcceptSms 
{ get 
    { if(IsMobile == true)
       {return ...}
    }
}
4

0 回答 0