What exactly is wrong with it? I suspect that calling t.HasValue will not work for most datatypes. If you are using your own datatypes you may need to use some reflection (very easy in C# compared to other languages) to figure out if the datatype actually has a .HasValue property.
Try adding some sort of functionality like this (if this is actually the problem you are having):
private bool HasValueMember (object ob)
return (ob is DATA_TYPE_WITH_HASVALUE_MEMBER || ob is ANOTHER_DATATYPE_WITH_HASVALUE_MEMBER)
Where DATA_TYPE_WITH_HASVALUE_MEMBER and ANOTHER_DATATYPE_WITH_HASVALUE_MEMBER are known datatypes that contain this property. This kind of takes away from the genric-ness of templates, but this link might help with that a bit: