Tech Off Post

Single Post Permalink

View Thread: Functional Style Boolean Logic in C#
  • User profile image
    AceHack

    Actually after looking more carefully it looks like the And function might be more like below, which is better?

     

            public static readonly Func<Bool, Func<Bool, Bool>> And =
                new Func<Bool, Func<Bool, Bool>>(a =>
                    a is True ?
                    new Func<Bool, Bool>(b => b) :
                    new Func<Bool, Bool>(_ => False));