Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 1.04 KB

README.md

File metadata and controls

48 lines (41 loc) · 1.04 KB

Skivsoft.Processor

Simple data processing library.

Example of usage

using System;
using Skivsoft.Processor;

namespace ConsoleApp1
{
    public class HelloContext
    {
        public string Name { get; set; }
    }

    public class InputName : IProcessor<HelloContext>
    {
        public void Execute(HelloContext context)
        {
            Console.WriteLine("Enter your name:");
            context.Name = Console.ReadLine();
        }
    }

    public class OutputGreetings : IProcessor<HelloContext>
    {
        public void Execute(HelloContext context)
        {
            Console.WriteLine($"Hello {context.Name}!");
        }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            IProcessor<HelloContext>[] steps = {
                new InputName(),
                new OutputGreetings()
            };
            IProcessor<HelloContext> processor = new ProcessorGroup<HelloContext>(steps);
            processor.Execute(new HelloContext());
        }
    }
}