Back to list
Views:   0
Replies:  0
Archived
,
Reply 1
This is all about Generics (http://msdn.microsoft.com/en-us/library/ms379564(v=vs.80).aspx), And generics allows you to define type-safe data structures, without committing to actual data types.

public class Presenter<T>

In the above example, T could be any type. But in your example, generic constraints are used. This means that where T is used, it must be derived from an IView interface. This means that you are enforcing anyone what uses the presenter to supply a view that derives from an IView interface.

I do think that when you specify a generic constraint like this that Visual Studio will provide you with intellisense as well.

This is not the same as abstract class, instead it is a means of adding type-safety with generics and also to add some constraints as to what base type the developer can use for the generic type T.

Hope that made sense.
Good Luck!

 
Robert Blixt, Jul 12, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas