diff Implab.Playground/Program.cs @ 277:963b17c275be v3

Refactoring Added <array> element to injection parameters Working on registrations of factories
author cin
date Sat, 28 Apr 2018 18:48:09 +0300
parents 22629bf26121
children 6691aff01de1
line wrap: on
line diff
--- a/Implab.Playground/Program.cs	Sat Apr 28 00:11:38 2018 +0300
+++ b/Implab.Playground/Program.cs	Sat Apr 28 18:48:09 2018 +0300
@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
 using Implab.Diagnostics;
@@ -22,6 +23,10 @@
 
         public string StringValue { get; set; }
 
+        public void AddRange(Foo[] items) {
+            Console.WriteLine($"AddRange: Foo[]");
+        }
+
     }
 
     public interface IContainer<T> {
@@ -42,30 +47,44 @@
         public void SetInstance(T value) {
             Instance = value;
         }
+
+        public void AddRange(List<T> items) {
+            Console.WriteLine($"AddRange: {typeof(List<T>)}");
+        }
+
+        public void AddRange(T[] items) {
+            Console.WriteLine($"AddRange: T[] ofType {typeof(T[])}");
+        }
     }
 
     public class Program {
 
         static void Main(string[] args) {
+            var listener = new SimpleTraceListener(Console.Out);
+            var source = Trace<TypeResolver>.TraceSource;
+            source.Switch.Level = SourceLevels.All;
+            source.Listeners.Add(listener);
+
             var stopwatch = new Stopwatch();
             stopwatch.Start();
 
             var ctx = new ContainerBuilder();
 
             Console.WriteLine($"Created: {stopwatch.ElapsedMilliseconds}");
-
+            stopwatch.Restart();
+            
             ctx.LoadConfig("data/sample.xml");
 
             Console.WriteLine($"Loaded: {stopwatch.ElapsedMilliseconds}");
 
             var container = ctx.Container;
 
-            
-
+            stopwatch.Restart();
             var instace1 = container.Resolve<IContainer<string>>();
             Console.WriteLine($"Resolved1: {stopwatch.ElapsedMilliseconds}");
+
+            stopwatch.Restart();
             var instace2 = container.Resolve<IContainer<Foo>>();
-
             Console.WriteLine($"Resolved2: {stopwatch.ElapsedMilliseconds}");
 
             DisplayContainerRegistrations(container);