5

In chapter eight (p189) of "CLR Via C#", Jeffrey Richter states that:

"A Type constructor can be applied to interfaces (although C# doesn't allow this)"

I've done a little bit of research and I can't seem to find why an interface would ever need a type constructor, in any language. This seems like something that you would explicitly disallow in the CLR.

When would this ever be needed, and why is it possible?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Robert Venables
  • 5,943
  • 1
  • 23
  • 35
  • I'm not sure what the answer is but I found another article that along the same lines that may be of interest: http://stackoverflow.com/questions/619856/interface-defining-a-constructor-signature – Malcolm Jul 17 '09 at 17:56

2 Answers2

3

You may be interested in reading this question and some of its answers on SO.

It basically covers how the C# compiler instantiates COM objects based on interfaces. It's not necessarily the same situation that Richter discusses, but its an interesting case of instantiating interfaces.

Community
  • 1
  • 1
LBushkin
  • 129,300
  • 32
  • 216
  • 265
0

Think of it in situations where you want to treat the interface as an abstract class. Although C# doesn't support that.

mfawzymkh
  • 4,030
  • 1
  • 16
  • 12