public static void Main(string[] args) { RegisterTypes(); numberWriter = dependencyResolver.Container.Resolve <INumberWriter>(); numberWriter.WriteNumbersToFile(100); Console.WriteLine("File write done."); Console.ReadLine(); }
/// <summary> /// Constructs a new writer instance. /// </summary> /// <param name="context">Must not be null. Can be reused from a read operation.</param> public FileChunkWriter(ChunkFileContext context) : base(context) { Check.IfArgumentNull(context, nameof(context)); Check.IfArgumentNull(context.Services, nameof(context.Services)); _streamNavigator = context.Services.GetService <IStreamNavigator>(); _handlerMgr = context.Services.GetService <FileChunkHandlerManager>(); _stringWriter = context.Services.GetService <IStringWriter>(); _numberWriter = context.Services.GetService <INumberWriter>(); context.Services.AddService(GetType(), this); }
public TensWriter(Dictionary <int, string> tensDictionary, INumberWriter digitWriter) { if (tensDictionary.Keys.Any(key => !IsTens(key))) { throw new ArgumentOutOfRangeException("tensDictionary", "Only double digits dictionary are allowed."); } if (digitWriter == null) { throw new ArgumentNullException("digitWriter"); } _tensDictionary = tensDictionary; _digitWriter = digitWriter; }
static void Main(string[] args) { #region "beforefieldinit" //http://csharpindepth.com/Articles/General/Beforefieldinit.aspx //Console.WriteLine("Starting Main"); //// Invoke a static method on Test //Test.EchoAndReturn("Echo!"); //Console.WriteLine("After echo"); //// Reference a static field in Test //string y = Test.x; //// Use the value just to avoid compiler cleverness //if (y != null) //{ // Console.WriteLine("After field access"); //} #endregion RegisterTypes(); _numberWriter = _dependencyResolver.Container.Resolve <INumberWriter>(); _numberWriter.WriteNumbersToFile(100); Console.WriteLine("File write done."); Console.ReadKey(); }
public HundredsWriter(INumberWriter tensWriter) { _tensWriter = tensWriter; }
public SpecialWorker(IStringWriter stringWriter, INumberWriter numberWriter) { _stringWriter = stringWriter; _numberWriter = numberWriter; }
public UnitWriter(Dictionary <int, string> units, INumberWriter hundredsWriter) { _unitsDictionary = units; _hundredsWriter = hundredsWriter; }