I would simply use the type int?
instead of int
. Int?
is a nullable integer. Take a look at this documentation on how to use it properly: http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx
Update: If you can't change the type, I would create an additional property of type int?
public int? nullableStatId
{
get { StatId == 0 ? return null : return StatId; }
set { StatId = value; }
}