Example #1
0
        public static ICoder <IEnumerable <T> > GenSwitch <T>(ICoder <object> switchCoder, ICoder <T> labelCoder, ICoder <T> statementCoder, ICoder <object> defaultCoder)
            where T : class
        {
            var sing = labelCoder.WithPrefix("\tcase ").WithPostfix(":").Combine(statementCoder, Id).WithPostfix("break;");
            var body = sing.Many("\n").WithPostfix("\n\tdefault:").Combine(defaultCoder, m => new object()).Between("\n").Brace();

            return(body.CombineReverse(switchCoder.Bracket().WithPrefix("switch").WithPostfix("\n"), m => new object()));
        }