8

Why is that?

This is not a question about the using keyword.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Stig
  • 1,974
  • 2
  • 23
  • 50
  • 1
    Maybe this other question resolves your question: http://stackoverflow.com/questions/1253266/why-explicit-implementation-of-a-interface-can-not-be-public – Matías Fidemraizer Mar 17 '11 at 12:00

1 Answers1

8

System.ServiceModel.ServiceHost implements the IDisposable interface explicitly. This prevents that interface complicating the the ServiceHost class itself. It also avoids situations where more than one interface implemented by a class defines a method with the same signature.

The Dispose method can be accessed by casting the ServiceHost object to an IDisposable.

Also helpful Q/A around it.

JackGrinningCat
  • 480
  • 4
  • 9
sheikhjabootie
  • 7,308
  • 2
  • 35
  • 41