I have a generic interface IDataAdapter; implementors of the interface should be able to read POCOs with Guid IDs from a data source.
If you look at Nullable Struct's documentation you can see that it requires to be a struct:
public struct Nullable where T : struct
I believe you will need to constraint T to be a struct:
interface IA where T : struct
{
T? Read(Guid id);
// Or Nullable Read(Guid id);
}
class A : IA
{
public int? Read(Guid id) { Console.WriteLine("A"); return 0; }
}
BTW. Could you give us an example of what types you want to use this class with?
Why not just use where T: class and return T (or even not have a constraint at all)?
interface IA where T : class
{
T Read(Guid id);
}