I have a generic Struct "FileProperty" which consists of an int 'offset' and a T 'value'. If I do something like the following..:
FileProperty<long?> fp1 = new FileProperty(value: null, offset: 0);
fp1.value = 1;
..neither of the following work:
FileProperty<long> fp2;
fp2 = fp1; // Cannot implicitly convert type 'Database.FileProperty<long>' to 'Database.FileProperty<long?>'
fp2 = (FileProperty<long>) fp1; // Cannot convert type 'Database.FileProperty<long>' to 'Database.FileProperty<long?>'
Even if I write an explicit conversion I just get:
'User-defined operator cannot convert a type to itself'
which makes sense but doesn't help me.
The issue I am having is that I know 'T? != null' but I can't convert Foo<T?> to Foo.