Esempio n. 1
0
        public string Process(string flag)
        {
            // using delegate
            var val = "cool";
            var num = 1;


            var features = FeatureFunctions <Func <string, int, string> >
                           .Create(new NewFeature().ProcessSomeData,
                                   new NewFeature().ProcessSomeDataV2);

            return(FeatFactory.FuncFactory(features, Constants.FeatFlag == flag)(val, num));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // factory pattern using Interface
            var result = FeatFactory
                         .GetFeatureImplementation(Constants.FeatFlag)
                         .DoStuff();

            Console.WriteLine(result);


            // factory using Func<>
            var features = FeatureFunctions <Func <string, int, string> >
                           .Create(new NewFeature().ProcessSomeData,
                                   new NewFeature().ProcessSomeDataV2);

            result = FeatFactory.FuncFactory(features, Constants.FeatFlag == "mycoolFlag")("foo", 1);

            Console.WriteLine(result);
        }