You started correctly, and then made a mess. How a compiler can know that
x
has the member
UniqueId
?
You need to do it as in the generic class
ExtendReceive
. In this class, the compiler knows that the parameter is
Appointment
(this exact type or derived from this class), due to the constraint
where T: Appointment
. This is the whole idea behind those constraints.
In case of second error, I the declaration of
System.Threading.Tasks.Dataflow.BufferBlock.TryReceive
(thanks for clarification) shows this signature (
http://msdn.microsoft.com/en-us/library/hh194808%28v=vs.110%29.aspx[
^]):
public static bool TryReceive<TOutput>(
this IReceivableSourceBlock<TOutput> source,
out TOutput item
)
I have no idea why did you decide that there is a method with the same name expecting an integer argument. Moreover, this method is static, you cannot possibly call it on
m_Queue
, the call syntax would be
BufferBlock.TryReceive(/* ... */)
. Here, you have a problem with programming basics, not even specifically related to .NET generics.
—SA