Hi Guys,
I want to default value(getter value) to be set for the data property , if the value set by the user does not meet the condition(without private variables).
Here is the code
public class TreeViewModel
{
public a()
{
this.Height = 200;
}
public int Height { get; set ; }
}
If the user sets the value of height lesser that 200 , I want the default value(200) to be set. I tried the following code but not successful as I need to define a body for get (coding in c# MVC)
public int Height { get; set {
if (value < 200)
value = 200;
} }