A class can be registered as a service by adding it to the IServiceCollection instance under the ConfigureServices() method in the Startup class.
A class MyClass can be registered as a service in the below ways:
services.AddT<MyClass>(new MyClass()); (or)
services.AddT<new MyClass());
services.AddT<IMyClass, MyClass>(); (or)
services.AddT<IMyClass>(new MyClass());
Where T can be Singleton, Transient or Scoped.