如何为. _Property
_ UserControl
考虑以下代码:
public class Date
{
private int month = 7; // Backing store
public int Month
{
get
{
return month;
}
set
{
if ((value > 0) && (value < 13))
{
month = value;
}
}
}
}
它将检查该Month
值是否介于 1 和 12 之间,但我也希望显示无效输入消息,以防它无效。有任何想法吗 ?