2

I'm learning about Microsoft.Extensions.Hosting, and I've come across the HostBuilder.Build() method. I can see that it returns an instance of IHost interface ('an initialise IHost', according to learn.microsoft.com), but I don't know what class this instance object is a type of. Doesn't this object need to belong to a class that implements the IHost interface?

Elon Obama
  • 29
  • 6

1 Answers1

3

Doesn't this object need to belong to a class that implements the IHost interface?

Yes, HostBuilder.Build() returns an instance of class implementing the IHost interface, but the class itself can be an internal one (for example).

You can get the actual type name by calling GetType().FullName on the returned instance but in general you should not care about underlying implementation that much.

Guru Stron
  • 102,774
  • 10
  • 95
  • 132