Exemplo n.º 1
0
        public static void ClosedDelegateForProperty()
        {
            var d = DelegateHelpers.CreateClosedDelegateFactory <Func <int> >(() => "".Length).Invoke("abcd");

            Equal(4, d());
        }
Exemplo n.º 2
0
        public static void OpenDelegateConversion()
        {
            var d = DelegateHelpers.CreateOpenDelegate <Func <decimal, long> >(i => (long)i);

            Equal(42L, d(42M));
        }
Exemplo n.º 3
0
        public static void ClosedDelegate()
        {
            var d = DelegateHelpers.CreateClosedDelegateFactory <Func <char, int, int> >((ch, startIndex) => "".IndexOf(ch, startIndex)).Invoke("abc");

            Equal(1, d('b', 0));
        }