Why is there no IQueue or IStack interface in the .NET Framework? [closed]

Well, because there would be one to one mapping from those interfaces to classes that implement them (except latest ConcurrentQueue). But other mentioned interfaces have lots of classes that implement them.

Expanding a bit. We can’t know real motivation of BCL team. But i have a feeling that when they created Queue and Stack those classes looked so trivial so they decided not to abstract them out to interfaces. Reason is obvious: classes looked so simple but complete at the same time so there was no reason to create different implementations of them in BCL. Then came ConcurrentQueue and previous statement became slightly incorrect.

As it pointed Queue and ConcurrentQueue don’t have that much similar to make them implement single interface.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)