What is the difference between GetService and GetInstance in CSL

I'm coding a Common Service Locator, and it's hard for me to understand the semantic differences between GetInstance, GetAllInstances and GetService (GetAllInstances is pretty obvious, but both GetInstance and GetService seem to return an object).

For example, what are the MEF equivalents of these three methods?

+3
source share
1 answer

There is no semantic difference:

  • GetService (type serviceType)
  • GetInstance (type serviceType)
  • GetInstance <TService> ()

All of them will call GetInstance (serviceType, null) internally.

Also the link does not mention the GetService method. http://commonservicelocator.codeplex.com/wikipage?title=API%20Reference&referringTitle=Home

: http://commonservicelocator.codeplex.com/SourceControl/changeset/view/27688#332684

+2

Source: https://habr.com/ru/post/1775343/


All Articles