Re: Generics Question
- From: "Scott M." <smar@xxxxxxxxxxxxx>
- Date: Fri, 23 Nov 2007 16:31:57 -0500
But that's what I don 't understand. Why can't I create a parameterized
constructor for a class and have its parameter be of an interface type?
Sub New(x As IEmployee)
Then this type would be essentially parameterized, would it not?
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.21b141f476c8953a644@xxxxxxxxxxxxxxxxxxxxxxx
Scott M. <smar@xxxxxxxxxxxxx> wrote:
I don't know Jon, that's why I asked the question.
Well, you asked it in a way that sounded like you were proposing a
solution. What would your parameterized constructor look like?
In short, to answer your original question: no, you couldn't do
everything that generics offers with interfaces, because interfaces
don't allow you to parameterize types or methods *by types*.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.
- Follow-Ups:
- Re: Generics Question
- From: Jon Skeet [C# MVP]
- Re: Generics Question
- References:
- Generics Question
- From: Scott M.
- Re: Generics Question
- From: Mattias Sjögren
- Re: Generics Question
- From: Scott M.
- Re: Generics Question
- From: Jon Skeet [C# MVP]
- Re: Generics Question
- From: Scott M.
- Re: Generics Question
- From: Jon Skeet [C# MVP]
- Generics Question
- Prev by Date: Re: Is it possbile to enumerate Methods by Event?
- Next by Date: Re: Generics Question
- Previous by thread: Re: Generics Question
- Next by thread: Re: Generics Question
- Index(es):
Relevant Pages
|
Loading