当前位置: 首页>>代码示例>>C#>>正文


C# IProperty.GetSetMethod方法代码示例

本文整理汇总了C#中IProperty.GetSetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# IProperty.GetSetMethod方法的具体用法?C# IProperty.GetSetMethod怎么用?C# IProperty.GetSetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProperty的用法示例。


在下文中一共展示了IProperty.GetSetMethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreatePropertyStub

        Property CreatePropertyStub(ClassDefinition node, IProperty baseProperty)
        {
            //try to complete partial implementation if any
            Property property = node.Members[baseProperty.Name] as Property;
            if (null == property) {
                property = new Property(LexicalInfo.Empty);
                property.Name = baseProperty.Name;
                property.Modifiers = TypeSystemServices.GetAccess(baseProperty) | TypeMemberModifiers.Virtual;
                property.IsSynthetic = true;
                DeclareParameters(property, baseProperty.GetParameters(), baseProperty.IsStatic ? 0 : 1);
                property.Type = CreateTypeReference(baseProperty.Type);
            }

            if (property.Getter == null && null != baseProperty.GetGetMethod())
                property.Getter = CreateMethodStub(baseProperty.GetGetMethod());

            if (property.Setter == null && null != baseProperty.GetSetMethod())
                property.Setter = CreateMethodStub(baseProperty.GetSetMethod());

            EnsureEntityFor(property);
            return property;
        }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:22,代码来源:BooCodeBuilder.cs

示例2: CreatePropertySet

 public MethodInvocationExpression CreatePropertySet(Expression target, IProperty property, Expression value)
 {
     return CreateMethodInvocation(target, property.GetSetMethod(), value);
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:BooCodeBuilder.cs

示例3: SetProperty

        void SetProperty(IProperty property, Expression reference, Expression value, bool leaveValueOnStack)
        {
            OpCode callOpCode = OpCodes.Call;

            MethodInfo setMethod = GetMethodInfo(property.GetSetMethod());
            IType targetType = null;
            if (null != reference)
            {
                if (!setMethod.IsStatic)
                {
                    Expression target = ((MemberReferenceExpression)reference).Target;
                    targetType = target.ExpressionType;
                    if (setMethod.DeclaringType.IsValueType || targetType is IGenericParameter)
                        LoadAddress(target);
                    else
                    {
                        callOpCode = GetCallOpCode(target, property.GetSetMethod());
                        target.Accept(this);
                        PopType();
                    }
                }
            }

            value.Accept(this);
            EmitCastIfNeeded(property.Type, PopType());

            LocalBuilder local = null;
            if (leaveValueOnStack)
            {
                _il.Emit(OpCodes.Dup);
                local = _il.DeclareLocal(GetSystemType(property.Type));
                _il.Emit(OpCodes.Stloc, local);
            }

            if (targetType is IGenericParameter)
            {
                _il.Emit(OpCodes.Constrained, GetSystemType(targetType));
                callOpCode = OpCodes.Callvirt;
            }

            _il.EmitCall(callOpCode, setMethod, null);

            if (leaveValueOnStack)
            {
                _il.Emit(OpCodes.Ldloc, local);
                PushType(property.Type);
            }
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:48,代码来源:EmitAssembly.cs

示例4: ResolveClassAbstractProperty

        void ResolveClassAbstractProperty(ClassDefinition node,
			TypeReference baseTypeRef,
			IProperty entity)
        {
            bool resolved = false;

            foreach (TypeMember member in node.Members)
            {
                if (entity.Name != member.Name
                    || NodeType.Property != member.NodeType
                    || !IsCorrectExplicitMemberImplOrNoExplicitMemberAtAll(member, entity)
                    || !TypeSystemServices.CheckOverrideSignature(entity.GetParameters(), GetPropertyEntity(member).GetParameters()))
                    continue;

                Property p = (Property) member;
                ProcessPropertyAccessor(p, p.Getter, entity.GetGetMethod());
                ProcessPropertyAccessor(p, p.Setter, entity.GetSetMethod());
                if (null == p.Type)
                {
                    p.Type = CodeBuilder.CreateTypeReference(entity.Type);
                }
                else
                {
                    if (entity.Type != p.Type.Entity)
                        Error(CompilerErrorFactory.ConflictWithInheritedMember(p, p.FullName, entity.FullName));
                }
                resolved = true;
            }

            if (resolved)
                return;

            foreach(SimpleTypeReference parent in node.BaseTypes)
            {
                if(_classDefinitionList.Contains(parent.Name))
                {
                    depth++;
                    ResolveClassAbstractProperty(_classDefinitionList[parent.Name] as ClassDefinition, baseTypeRef, entity);
                    depth--;
                }
            }

            if(CheckInheritsInterfaceImplementation(node, entity))
                return;

            if(depth == 0)
            {
                node.Members.Add(CreateAbstractProperty(baseTypeRef, entity));
                AbstractMemberNotImplemented(node, baseTypeRef, entity);
            }
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:51,代码来源:ProcessInheritedAbstractMembers.cs

示例5: CreateAbstractProperty

        Property CreateAbstractProperty(TypeReference reference, IProperty property)
        {
            Debug.Assert(0 == property.GetParameters().Length);
            Property p = CodeBuilder.CreateProperty(property.Name, property.Type);
            p.Modifiers |= TypeMemberModifiers.Abstract;

            IMethod getter = property.GetGetMethod();
            if (getter != null)
            {
                p.Getter = CodeBuilder.CreateAbstractMethod(reference.LexicalInfo, getter);
            }

            IMethod setter = property.GetSetMethod();
            if (setter != null)
            {
                p.Setter = CodeBuilder.CreateAbstractMethod(reference.LexicalInfo, setter);
            }
            return p;
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:19,代码来源:ProcessInheritedAbstractMembers.cs

示例6: HasSetter

 private static bool HasSetter(IProperty property)
 {
     return property.GetSetMethod() != null;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:ProcessInheritedAbstractMembers.cs


注:本文中的IProperty.GetSetMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。