public void Run() { var factory = new SampleObjectFactory(); var manipulator = new SampleObjectManipulator(); var obj = (factory as ISampleObjectFactory).CreateEmpty(); (manipulator as ISampleObjectManipulator).WriteIntoLogs(obj); }
/// <summary> /// Создает новый или возвращает существующий экземпляр манипулятора объектами <see cref="SampleObject"/>. /// </summary> public ISampleObjectManipulator CreateManipulator() { var manipulator = _instances.OfType <ISampleObjectManipulator>().FirstOrDefault(); if (manipulator != null) { return(manipulator); } manipulator = new SampleObjectManipulator(); _instances.Add(manipulator); return(manipulator); }