• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ITypeDefinitionMember类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITypeDefinitionMember的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefinitionMember类的具体用法?C# ITypeDefinitionMember怎么用?C# ITypeDefinitionMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITypeDefinitionMember类属于命名空间,在下文中一共展示了ITypeDefinitionMember类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ThinMember

        public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
                          IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility)

            : this(declaringType, memberName, returnType, memberType,
                   includeStatus, memberNode, visibility, SecurityTransparencyStatus.Transparent)
        {
        }
开发者ID:jango2015,项目名称:buildtools,代码行数:7,代码来源:Thinner.cs


示例2: MemberGroupHeading

        public static string MemberGroupHeading(ITypeDefinitionMember member)
        {
            if (member == null)
                return null;

            IMethodDefinition method = member as IMethodDefinition;
            if (method != null)
            {
                if (method.IsConstructor)
                    return "Constructors";

                return "Methods";
            }

            IFieldDefinition field = member as IFieldDefinition;
            if (field != null)
                return "Fields";

            IPropertyDefinition property = member as IPropertyDefinition;
            if (property != null)
                return "Properties";

            IEventDefinition evnt = member as IEventDefinition;
            if (evnt != null)
                return "Events";

            INestedTypeDefinition nType = member as INestedTypeDefinition;
            if (nType != null)
                return "Nested Types";

            return null;
        }
开发者ID:pgavlin,项目名称:ApiTools,代码行数:32,代码来源:CSharpWriter.cs


示例3: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            bool isImplOverridable = IsOverridable(impl);
            bool isContractOverridable = IsOverridable(contract);

            /*
            //@todo: Move to a separate rule that's only run in "strict" mode. 
            if (isImplInhertiable && !isContractInheritiable)
            {
                // This is separate because it can be noisy and is generally allowed as long as it is reviewed properly.
                differences.AddIncompatibleDifference("CannotMakeMemberVirtual",
                    "Member '{0}' is virtual in the implementation but non-virtual in the contract.",
                    impl.FullName());

                return DifferenceType.Changed;
            }
            */

            if (isContractOverridable && !isImplOverridable)
            {
                differences.AddIncompatibleDifference("CannotMakeMemberNonVirtual",
                    "Member '{0}' is non-virtual in the implementation but is virtual in the contract.",
                    impl.FullName());

                return DifferenceType.Changed;
            }

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:32,代码来源:CannotMakeNonVirtual.cs


示例4: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            if (!impl.ContainingTypeDefinition.IsEnum || !contract.ContainingTypeDefinition.IsEnum)
                return DifferenceType.Unknown;

            IFieldDefinition implField = impl as IFieldDefinition;
            IFieldDefinition contractField = contract as IFieldDefinition;

            Contract.Assert(implField != null || contractField != null);

            string implValue = Convert.ToString(implField.Constant.Value);
            string contractValue = Convert.ToString(contractField.Constant.Value);

            // Calling the toString method to compare in since we might have the case where one Enum is type a and the other is type b, but they might still have same value.
            if (implValue != contractValue)
            {
                ITypeReference implValType = impl.ContainingTypeDefinition.GetEnumType();
                ITypeReference contractValType = contract.ContainingTypeDefinition.GetEnumType();

                differences.AddIncompatibleDifference(this,
                    "Enum value '{0}' is ({1}){2} in the implementation but ({3}){4} in the contract.",
                    implField.FullName(), implValType.FullName(), implField.Constant.Value,
                    contractValType.FullName(), contractField.Constant.Value);
                return DifferenceType.Changed;
            }

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:31,代码来源:EnumValuesMustMatch.cs


示例5: Include

        public virtual bool Include(ITypeDefinitionMember member)
        {
            if (member == null)
                return false;

            if (!member.ContainingTypeDefinition.IsVisibleOutsideAssembly())
                return false;

            switch (member.Visibility)
            {
                case TypeMemberVisibility.Public:
                    return true;
                case TypeMemberVisibility.Family:
                case TypeMemberVisibility.FamilyOrAssembly:
                    // CCI's version of IsVisibleOutsideAssembly doesn't
                    // consider protected members as being visible but for
                    // our purposes which is to write CS files that can
                    // be compiled we always need the protected members
                    return true;
            }

            if (!member.IsVisibleOutsideAssembly())
                return false;

            return true;
        }
开发者ID:pgavlin,项目名称:ApiTools,代码行数:26,代码来源:PublicOnlyCciFilter.cs


示例6: ScriptMember

        /// <summary>
        /// Creates a new instance of the class.
        /// </summary>
        /// <param name="container">The containing type.</param>
        /// <param name="memberDef">The CCI member definition.</param>
        internal ScriptMember(ScriptType container, ITypeDefinitionMember memberDef)
        {
            if (container == null || memberDef == null)
                throw new InvalidOperationException();

            _container = container;
            _cciMember = memberDef;
        }
开发者ID:JimmyJune,项目名称:blade,代码行数:13,代码来源:ScriptMember.cs


示例7: IsMemberExternallyVisible2

 // this method takes into account the FrameworkInternal annotation
 private bool IsMemberExternallyVisible2(ITypeDefinitionMember member)
 {
     return ((member.Visibility == TypeMemberVisibility.Public ||
               member.Visibility == TypeMemberVisibility.Family ||
               member.Visibility == TypeMemberVisibility.FamilyOrAssembly ||
               m_implModel.IsFrameworkInternal(member)) &&
              IsTypeExternallyVisible2(Util.ContainingTypeDefinition(member)));
 }
开发者ID:natemcmaster,项目名称:buildtools,代码行数:9,代码来源:ApiClosureVisitor.cs


示例8: Include

        // How MDIL affects member visibility:
        //
        // - A member marked [TreatAsPublicSurface] is treated as public regardless of its own visibility or that of its containing type.
        //
        public override bool Include(ITypeDefinitionMember member)
        {
            if (member == null)
                return false;

            //if (member.IsTreatedAsVisibleOutsideAssembly())
            //    return true;

            return base.Include(member);
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:14,代码来源:MdilPublicOnlyCciFilter.cs


示例9: GetMemberId

    public static string GetMemberId(ITypeDefinitionMember member)
    {
      Contract.Requires(member != null);
      Contract.Ensures(Contract.Result<string>() != null);

      using (TextWriter writer = new StringWriter())
      {
        WriteMember(member, writer);
        return (writer.ToString());
      }
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:11,代码来源:XmlDocIds.cs


示例10: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            bool added = false;

            //added |= AnyAttributeAdded(differences, impl, impl.Attributes, contract.Attributes);
            //added |= AnyMethodSpecificAttributeAdded(differences, impl as IMethodDefinition, contract as IMethodDefinition);

            if (added)
                return DifferenceType.Changed;

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:15,代码来源:AttributeDifference.cs


示例11: IsOverridable

        private bool IsOverridable(ITypeDefinitionMember member)
        {
            if (!member.IsVirtual())
                return false;

            // member virtual final is not overridable
            if (member.IsSealed())
                return false;

            // if member type is Effectively sealed and cannot be extended, then the member cannot be inherited
            if (member.ContainingTypeDefinition != null && member.ContainingTypeDefinition.IsEffectivelySealed())
                return false;

            return true;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:15,代码来源:CannotMakeNonVirtual.cs


示例12: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            IMethodDefinition implMethod = impl as IMethodDefinition;
            IMethodDefinition contractMethod = contract as IMethodDefinition;

            if (implMethod == null || contractMethod == null)
                return DifferenceType.Unknown;

            if (!ParamNamesMatch(differences, implMethod, contractMethod))
                return DifferenceType.Changed;

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:16,代码来源:ParameterNamesCannotChange.cs


示例13: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            IMethodDefinition method1 = impl as IMethodDefinition;
            IMethodDefinition method2 = contract as IMethodDefinition;

            if (method1 == null || method2 == null)
                return DifferenceType.Unknown;

            if (!ParamModifiersMatch(differences, method1, method2))
                return DifferenceType.Changed;

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:16,代码来源:ParameterModifiersCannotChange.cs


示例14: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            if (impl.IsAbstract() && !contract.IsAbstract())
            {
                differences.AddIncompatibleDifference("CannotMakeMemberAbstract",
                    "Member '{0}' is abstract in the implementation but is not abstract in the contract.",
                    impl.FullName());

                return DifferenceType.Changed;
            }

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:16,代码来源:CannotMakeAbstract.cs


示例15: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (contract != null && impl == null)
            {
                if (contract.ContainingTypeDefinition.IsInterface)
                {
                    differences.AddIncompatibleDifference(this, "Contract interface member '{0}' is not in the implementation.", contract.FullName());
                    return DifferenceType.Changed;
                }
            }

            if (impl != null && contract == null)
            {
                if (impl.ContainingTypeDefinition.IsInterface)
                {
                    differences.AddIncompatibleDifference(this, "Implementation interface member '{0}' is not in the contract.", impl.FullName());
                    return DifferenceType.Changed;
                }
            }

            return base.Diff(differences, impl, contract);
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:22,代码来源:InterfacesShouldHaveSameMembers.cs


示例16: WriteMember

    private static void WriteMember(ITypeDefinitionMember member, TextWriter writer)
    {
      Contract.Requires(member != null);
      Contract.Requires(writer != null);

      IMethodDefinition method = member as IMethodDefinition;
      if (method != null)
      {
        writer.Write("M:");
        WriteMethod(method, writer);
        return;
      }

      IFieldDefinition field = member as IFieldDefinition;
      if (field != null)
      {
        writer.Write("F:");
        WriteField(field, writer);
        return;
      }

      IPropertyDefinition property = member as IPropertyDefinition;
      if (property != null)
      {
        writer.Write("P:");
        WriteProperty(property, writer);
        return;
      }

      IEventDefinition eventdef = member as IEventDefinition;
      if (eventdef != null)
      {
        writer.Write("E:");
        WriteEvent(eventdef, writer);
        return;
      }
      throw new NotImplementedException("missing case");
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:38,代码来源:XmlDocIds.cs


示例17: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
        {
            if (impl == null || contract == null)
                return DifferenceType.Unknown;

            // If implementation is public then contract can be any visibility
            if (impl.Visibility == TypeMemberVisibility.Public)
                return DifferenceType.Unknown;

            // If implementation is protected then contract must be protected as well. 
            if (impl.Visibility == TypeMemberVisibility.Family)
            {
                if (contract.Visibility != TypeMemberVisibility.Family)
                {
                    differences.AddIncompatibleDifference(this,
                        "Visibility of member '{0}' is '{1}' in the implementation but '{2}' in the contract.",
                        impl.FullName(), impl.Visibility, contract.Visibility);
                    return DifferenceType.Changed;
                }
            }

            return DifferenceType.Unknown;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:23,代码来源:CannotMakeMoreVisible.cs


示例18: ShouldHideMember

        private bool ShouldHideMember(ITypeDefinitionMember member)
        {
            bool shouldHide = false;

            INamedTypeDefinition type = Util.ContainingTypeDefinition(member);
            if (IsHiddenMemberCandidate(member))
            {
                if (!TypeIsVisibleInApi(type))
                {
                    // Declaring type is hidden, only modify the visibility on a 
                    // member when its corresponding member on a public base type 
                    // was hidden.

                    INamedTypeDefinition baseType = Util.CanonicalizeType(TypeHelper.BaseClass(type));
                    while (baseType != null && baseType != Dummy.Type)
                    {
                        if (TypeIsVisibleInApi(baseType))
                        {
                            ITypeDefinitionMember relatedMember = Util.FindRelatedMember(baseType, member);
                            if (relatedMember != null)
                            {
                                ITypeDefinitionMember canonicalizedRelatedMember = Util.CanonicalizeMember(relatedMember);
                                if (_depot.ContainsMember(canonicalizedRelatedMember) &&
                                    ShouldHideMember(canonicalizedRelatedMember))
                                {
                                    shouldHide = true;
                                    break;
                                }
                            }
                        }
                        baseType = Util.CanonicalizeType(TypeHelper.BaseClass(baseType));
                    }
                }
                else
                {
                    // declaring type is public, we must hide the member.
                    shouldHide = true;
                }
            }

            return shouldHide;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:42,代码来源:Implementation.cs


示例19: GetIncludeStatus

        private IncludeStatus GetIncludeStatus(ITypeDefinitionMember member)
        {
            ThinMember modelMember;
            if (!_rootMembers.TryGetValue(member, out modelMember))
            {
                if (_depot.ContainsMember(member))
                {
                    // Special case ImplRoot
                    // TODO: Visitor should set status instead.
                    if (_closureStatus == IncludeStatus.ApiRoot && !Util.IsMemberExternallyVisible(member))
                    {
                        return IncludeStatus.ImplRoot;
                    }

                    return _closureStatus;
                }

                throw new Exception("could not find IncludeStatus for member " + member.ToString());
            }

            return modelMember.IncludeStatus;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:22,代码来源:Implementation.cs


示例20: IsHiddenMemberCandidate

 private bool IsHiddenMemberCandidate(ITypeDefinitionMember member)
 {
     return !Util.IsApi(GetIncludeStatus(member)) && Util.IsMemberExternallyVisible(member);
 }
开发者ID:dsgouda,项目名称:buildtools,代码行数:4,代码来源:Implementation.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITypeDescriptor类代码示例发布时间:2022-05-24
下一篇:
C# ITypeDefinition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap