【发布时间】:2011-03-22 19:27:55
【问题描述】:
我想定义一个变量,该变量将接受 SET 中的字符串,然后将其转换为 Int32 并在 GET 期间使用它。
这里是我目前拥有的代码:
private Int32 _currentPage;
public String currentPage
{
get { return _currentPage; }
set
{
_currentPage = (string.IsNullOrEmpty(value)) ? 1 : Convert.ToInt32(value);
}
}
【问题讨论】:
标签: c# .net properties