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


C# ITypeDefinition.FullName方法代码示例

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


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

示例1: AddedBaseType

        private bool AddedBaseType(IDifferences differences, ITypeDefinition impl, ITypeDefinition contract)
        {
            // For interfaces we rely only on the AddedInterface check
            if (impl.IsInterface || contract.IsInterface)
                return false;

            // Base types must be in the same order so we have to compare them in order
            List<ITypeReference> implBaseTypes = new List<ITypeReference>(impl.GetAllBaseTypes());

            int lastIndex = 0;
            foreach (var contractBaseType in contract.GetAllBaseTypes())
            {
                lastIndex = implBaseTypes.FindIndex(lastIndex, item1BaseType => _typeComparer.Equals(item1BaseType, contractBaseType));

                if (lastIndex < 0)
                {
                    differences.AddIncompatibleDifference(this,
                        "Type '{0}' does not inherit from base type '{1}' in the implementation but it does in the contract.",
                        contract.FullName(), contractBaseType.FullName());
                    return true;
                }
            }

            return false;
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:25,代码来源:CannotRemoveBaseTypeOrInterface.cs

示例2: Diff

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

            if (ImplementsIDisposable(impl) && !ImplementsIDisposable(contract))
            {
                differences.AddIncompatibleDifference(this,
                    "Type '{0}' implements IDisposable in the implementation but not the contract.",
                    impl.FullName());
                return DifferenceType.Changed;
            }

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

示例3: Diff

        public override DifferenceType Diff(IDifferences differences, ITypeDefinition impl, ITypeDefinition contract)
        {
            if (impl == null && contract != null)
            {
                if (!ReportAsMembersMustExist(contract, differences))
                {
                    differences.AddIncompatibleDifference(this,
                        "Type '{0}' does not exist in the implementation but it does exist in the contract.", contract.FullName());
                }

                return DifferenceType.Added;
            }

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

示例4: Diff

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

            if (impl.IsEffectivelySealed() && !contract.IsEffectivelySealed())
            {
                differences.AddIncompatibleDifference(this,
                    "Type '{0}' is sealed in the implementation but not sealed in the contract.", impl.FullName());

                return DifferenceType.Changed;
            }

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

示例5: Diff

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

            if (impl.IsAbstract && !contract.IsAbstract)
            {
                differences.AddIncompatibleDifference("CannotMakeTypeAbstract",
                    "Type '{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

示例6: Diff

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

            string implObjType = GetObjectType(impl);
            string contractObjType = GetObjectType(contract);

            if (implObjType != contractObjType)
            {
                differences.AddIncompatibleDifference(this,
                    "Type '{0}' is a {1} in the implementation but is a {2} in the contract.",
                    impl.FullName(), implObjType, contractObjType);
            }

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

示例7: Diff

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

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

            ITypeReference implType = impl.GetEnumType();
            ITypeReference contractType = contract.GetEnumType();

            if (!_typeComparer.Equals(implType, contractType))
            {
                differences.AddTypeMismatchDifference(this, implType, contractType,
                    "Enum type for '{0}' is '{1}' in implementation but '{2}' in the contract.",
                    impl.FullName(), implType.FullName(), contractType.FullName());
                return DifferenceType.Changed;
            }

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

示例8: Diff

        // Consider the following object hierarchy.  Remember we are not enforcing a subset relationship
        // on both types.  Our goal is to build a third API that is a subset of both, with versioning rules
        // that will produce a consistent universe with both new frameworks.
        //             Object
        //        Fruit        Shape
        //       Apple
        //      Red Delicious
        // 
        // 1) A type is not reparented across the hierarchy.  (ie, Apple may subclass Object, but may not subclass Shape)
        // 2) Removing a type like Apple from the inheritance hierarchy is legal, BUT all new methods on Apple must be
        //    duplicated on Red Delicious.  (Methods will be tracked in a separate rule)
        // 3) If you removed a type like Apple, then all overridden methods from Fruit & higher should be
        //    re-overridden by Red Delicious to ensure behavior is compatible.  (methods will be tracked in a separate rule)
        // 4) It is legal to add a type like Fruit into the hierarchy - consider this the reverse of #2.
        // 5) If one Framework had Object -> NewType -> Apple, that is only legal if NewType is in the other 
        //    Framework's inheritance hierarchy somewhere between Object and Apple.  IE, NewType could be 
        //    "Food" or "RoundFruit", but could not be "Shape"
        public override DifferenceType Diff(IDifferences differences, ITypeDefinition item1, ITypeDefinition item2)
        {
            if (item1 == null || item2 == null)
                return DifferenceType.Unknown;

            Contract.Assert(_typeComparer != null);

            IEnumerable<ITypeReference> item1BaseClassChain = GetBaseClassChain(item1);
            IEnumerable<ITypeReference> item2BaseClassChain = GetBaseClassChain(item2);

            bool added = item2BaseClassChain.Except(item1BaseClassChain, _typeComparer).Any(t => true);
            bool removed = item1BaseClassChain.Except(item2BaseClassChain, _typeComparer).Any(t => true);

            // To a first approximation, we cannot both add base types and remove base types.
            // IE, we cannot take an Apple, remove Fruit and add Shape.
            // However there are more pathologically complicated inheritance hierarchies that are linear but where we 
            // add one type & remove another.  If both additions & removals occur, they're only legal if one of those 
            // added or removed types subclasses the other one.  We do not currently check for that.
            if (added && removed)
            {
                // Special case for DependencyObject and its derived types
                if (item1BaseClassChain.Any((type) => TypeHelper.GetTypeName(type) == "System.Windows.DependencyObject") &&
                    item2BaseClassChain.Any((type) => TypeHelper.GetTypeName(type) == "Windows.UI.DirectUI.DependencyObject"))
                {
                    // If the new type name is the same as the old type name in a new namespace, let's consider that a known issue.
                    String oldBaseTypeName = TypeHelper.GetTypeName(item1BaseClassChain.First());
                    String newBaseTypeName = TypeHelper.GetTypeName(item2BaseClassChain.First());
                    oldBaseTypeName = oldBaseTypeName.Replace("System.Windows", "Windows.UI.DirectUI");
                    if (oldBaseTypeName == newBaseTypeName)
                        return DifferenceType.Unknown;
                }

                differences.AddIncompatibleDifference(this,
                    "Type {0} or one of its base classes was reparented in an incompatible way.  Old base classes: {1}  New Base Classes: {2}",
                    item1.FullName(), PrintClassHierarchy(item1BaseClassChain), PrintClassHierarchy(item2BaseClassChain));
                return DifferenceType.Changed;
            }

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

示例9: AddedInterface

        private bool AddedInterface(IDifferences differences, ITypeDefinition impl, ITypeDefinition contract)
        {
            // Interfaces can be in any order so use a HashSet
            HashSet<ITypeReference> implInterfaces = new HashSet<ITypeReference>(impl.GetAllInterfaces(), _typeComparer);

            foreach (var contractInterface in contract.GetAllInterfaces())
            {
                // Ignore internal interfaces
                if (!contractInterface.IsVisibleOutsideAssembly())
                    continue;

                if (!implInterfaces.Contains(contractInterface))
                {
                    differences.AddIncompatibleDifference(this,
                        "Type '{0}' does not implement interface '{1}' in the implementation but it does in the contract.",
                            contract.FullName(), contractInterface.FullName());
                    return true;
                }
            }

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

示例10: Diff

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

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

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

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


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