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

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

            Equal(42L, d(42M));
        }
예제 #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));
        }