SHARE
TWEET

Lambda Refactor Tutorial - Base Classes

ncosentino Nov 12th, 2013 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Lambda Refactor Tutorial - Dev Leader
  2.  *
  3.  * Blog Post:
  4.  * http://devleader.ca/2013/11/14/lambdas-example-refactoring-code
  5.  *
  6.  * Classes:
  7.  * Program.cs:              http://pastebin.com/HsvqqBka
  8.  * Base Classes:            http://pastebin.com/s99Swhuk
  9.  * Pre Refactor Classes:    http://pastebin.com/4645gEgz
  10.  * Post Refactor Classes:   http://pastebin.com/ySLG2KqU
  11.  *
  12.  */
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Text;
  16.  
  17. namespace LambdaRefactor.Processing
  18. {
  19.     public interface IProcessor
  20.     {
  21.         bool TryProcess(object input);
  22.     }
  23.  
  24.     public interface IProcessorFactory
  25.     {
  26.         IProcessor Create(ProcessorType type, object mandatoryArgument, object value);
  27.     }
  28.  
  29.     public enum ProcessorType
  30.     {
  31.         GreaterThan,
  32.         LessThan,
  33.         NumericEqual,
  34.         StringEqual,
  35.         StringNotEqual,
  36.         /* we could add countless more types of processors here. realistically,
  37.          * an enum may not be the best option to accomplish this, but for
  38.          * demonstration purposes it'll make things much easier.
  39.          */
  40.     }
  41. }
RAW Paste Data
Want to get better at C#?
Learn to code C# in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top