using System; namespace SmallInjectorDemo { /// /// A very useful class. /// public class UsefulClass { private readonly IServiceOne _service1; private readonly IServiceTwo _service2; private readonly int _rand; /// /// Creates a new instance of . /// /// injected service one. /// injected service two. public UsefulClass(IServiceOne service1, IServiceTwo service2) { _service1 = service1; _service2 = service2; _rand = RandomHelper.NewRandomInteger(10, 99); Console.WriteLine(nameof(UsefulClass) + ".ctor\tId: " + _rand); } /// /// Test the injected services. /// public void TestTheServices() { Console.WriteLine(ToString()); Console.WriteLine(_service1.ToString()); Console.WriteLine(_service2.ToString()); } /// public override string ToString() => nameof(UsefulClass) + ".ToString()\tId: " + _rand; } }