Is it possible to set up a propery as both an int? for the Get and int for the set?
I am trying to set it up so that the set can recieve either an integer or a null.
The problem is that I don't want to have to do something like:
j = temp.Data.Value;
I would rather do:
j = temp.Data.
If I have the int?, I have to do temp.Data.Value.
Thanks,
Tom
I am trying to set it up so that the set can recieve either an integer or a null.
Code:
public int? Data
{
get { return data; }
set {
if (data == null)
{
data = 0;
nullData = true;
}
else
{
data = value;
nullData = false;
}
changed = true;
}
}
The problem is that I don't want to have to do something like:
j = temp.Data.Value;
I would rather do:
j = temp.Data.
If I have the int?, I have to do temp.Data.Value.
Thanks,
Tom