/// <summary> /// Handles the data via the chain of responsibility. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public void Handle(TData data) { if (IsMine(data)) { var isHandled = HandleData(data); if (isHandled == false) { _successor?.Handle(data); } } else { _successor?.Handle(data); } }
private static int Main(string[] args) { _argsCommander = new ArgumentsLengthHandler(); _argsCommander .SetSuccessor(new NoneTemplateKindHandler()) .SetSuccessor(new DefaultHandler()); return(_argsCommander.Handle(args)); }