We have come across a scenario where we need to track the setting and unsettling of a nullable type.
so something like
int? value
if(value.isSet())
{
addTocollection();
}
we would also need a clear function
value.clear();
The concept is that the data has an extra state that is the set state.
so NULL(set) and NULL(unset) have different meanings.
and then you have the value (set) for most cases and the value(unset) (this last case would have no meaning)
is there a way using extension methods or some other pattern that could solve this problem.
my current thought is that we will have to revert to an extended class of some sort.
I’m trying to understand what you’re after. I think it is something like the below (Dump is from LINQPad, just think Console.WriteLine). Overall, I don’t think this is a good idea, because you provide something obscure that does not work as expected. Unless I mis-understand what you want.