One function implementing Generic and non-generic interface?

The reason for this is that FavoriteItem of IFavoriteItem may not be IItem where on the IFavoriteItem it must be an IItem The only way to solve this is by: IItem IFavoriteItem. FavoriteItem { get { return FavoriteItem; } } This will simply shortcut the call to your TItem implementation A good example of where this is used quite often is with the implementation of IEnumerable These often look like this: public class MyEnumerable : IEnumerable { public IEnumerator GetEnumerator() { throw new NotImplementedException(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }.

The reason for this is that FavoriteItem of IFavoriteItem may not be IItem, where on the IFavoriteItem, it must be an IItem. The only way to solve this is by: IItem IFavoriteItem. FavoriteItem { get { return FavoriteItem; } } This will simply shortcut the call to your TItem implementation.

A good example of where this is used quite often is with the implementation of IEnumerable. These often look like this: public class MyEnumerable : IEnumerable { public IEnumerator GetEnumerator() { throw new NotImplementedException(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }.

– Shaddix Oct 29 '10 at 7:34 Because it can be an inherited interface of, or a class implementation of IItem. The where does not specify that it must be exactly IItem, but instead that it must be typeof(IItem). IsAssignableFrom().

However, your IFavoriteItem has the exact IItem type specified. – Pieter Oct 29 '10 at 7:36 I get it, thanks. – Shaddix Oct 29 '10 at 8:00 You're welcome.

– Pieter Oct 29 '10 at 8:01.

Yes, this was mine :) This is exactly the reason, why I can't have synonyms, and I understood this. This question is about why TItem:IItem isn't implementing IItem :) – Shaddix Oct 29 '10 at 7:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions