示例#1
0
            //-------------------------------------------------------------------------------------------------------------------------------------------------

            public override void DefineMemberBody()
            {
                var typedGetterDefinition = (GetterBodyDefinition as Action <IHappilMethodBody <T>, HappilArgument <TIndex1> >);
                var typedSetterDefinition = (SetterBodyDefinition as Action <IVoidHappilMethodBody, HappilArgument <TIndex1>, HappilArgument <T> >);

                using (TypeTemplate.CreateScope(
                           typeof(TypeTemplate.TIndex1), OwnerProperty.Declaration.GetIndexParameters()[0].ParameterType))
                {
                    if (typedGetterDefinition != null)
                    {
                        using ((GetterMethod as IHappilMember).CreateTypeTemplateScope())
                        {
                            using (GetterMethod.CreateBodyScope())
                            {
                                typedGetterDefinition(GetterMethod.GetMethodBody <T>(), new HappilArgument <TIndex1>(GetterMethod, 1));
                            }
                        }
                    }

                    if (typedSetterDefinition != null)
                    {
                        using ((SetterMethod as IHappilMember).CreateTypeTemplateScope())
                        {
                            using (SetterMethod.CreateBodyScope())
                            {
                                typedSetterDefinition(SetterMethod, new HappilArgument <TIndex1>(SetterMethod, 1), new HappilArgument <T>(SetterMethod, 2));
                            }
                        }
                    }
                }
            }
示例#2
0
            //-------------------------------------------------------------------------------------------------------------------------------------------------

            public override void DefineMemberBody()
            {
                var typedGetterDefinition = (GetterBodyDefinition as Action <IHappilMethodBody <T> >);
                var typedSetterDefinition = (SetterBodyDefinition as Action <IVoidHappilMethodBody, HappilArgument <T> >);

                if (typedGetterDefinition != null)
                {
                    using ((GetterMethod as IHappilMember).CreateTypeTemplateScope())
                    {
                        using (GetterMethod.CreateBodyScope())
                        {
                            typedGetterDefinition(GetterMethod.GetMethodBody <T>());
                        }
                    }
                }

                if (typedSetterDefinition != null)
                {
                    using ((SetterMethod as IHappilMember).CreateTypeTemplateScope())
                    {
                        using (SetterMethod.CreateBodyScope())
                        {
                            typedSetterDefinition(SetterMethod, new HappilArgument <T>(SetterMethod, 1));
                        }
                    }
                }
            }