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


C# CType.isStructType方法代码示例

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


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

示例1: LowerBoundInterfaceInference

        ////////////////////////////////////////////////////////////////////////////////

        private bool LowerBoundInterfaceInference(CType pSource, AggregateType pDest)
        {
            if (!pDest.isInterfaceType())
            {
                return false;
            }

            // SPEC:  Otherwise, if V is an interface CType C<V1...Vk> and U is a class CType
            // SPEC:   or struct CType and there is a unique set U1...Uk such that U directly 
            // SPEC:   or indirectly implements C<U1...Uk> then an
            // SPEC:   exact, upper-bound, or lower-bound inference ...
            // SPEC:  ... and U is an interface CType ...
            // SPEC:  ... and U is a CType parameter ...

            //TypeArray pInterfaces = null;

            if (!pSource.isStructType() && !pSource.isClassType() &&
                !pSource.isInterfaceType() && !pSource.IsTypeParameterType())
            {
                return false;
            }

            var interfaces = pSource.AllPossibleInterfaces();
            AggregateType pInterface = null;
            foreach (AggregateType pCurrent in interfaces)
            {
                if (pCurrent.GetOwningAggregate() == pDest.GetOwningAggregate())
                {
                    if (pInterface == null)
                    {
                        pInterface = pCurrent;
                    }
                    else if (pInterface != pCurrent)
                    {
                        // Not unique. Bail out.
                        return false;
                    }
                }
            }
            if (pInterface == null)
            {
                return false;
            }
            LowerBoundTypeArgumentInference(pInterface, pDest);
            return true;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:48,代码来源:MethodTypeInferrer.cs

示例2: UpperBoundInterfaceInference

        ////////////////////////////////////////////////////////////////////////////////

        private bool UpperBoundInterfaceInference(AggregateType pSource, CType pDest)
        {
            if (!pSource.isInterfaceType())
            {
                return false;
            }

            // SPEC:  Otherwise, if U is an interface CType C<U1...Uk> and V is a class CType
            // SPEC:   or struct CType and there is a unique set V1...Vk such that V directly 
            // SPEC:   or indirectly implements C<V1...Vk> then an exact ...
            // SPEC:  ... and U is an interface CType ...

            if (!pDest.isStructType() && !pDest.isClassType() &&
                !pDest.isInterfaceType())
            {
                return false;
            }

            var interfaces = pDest.AllPossibleInterfaces();
            AggregateType pInterface = null;
            foreach (AggregateType pCurrent in interfaces)
            {
                if (pCurrent.GetOwningAggregate() == pSource.GetOwningAggregate())
                {
                    if (pInterface == null)
                    {
                        pInterface = pCurrent;
                    }
                    else if (pInterface != pCurrent)
                    {
                        // Not unique. Bail out.
                        return false;
                    }
                }
            }
            if (pInterface == null)
            {
                return false;
            }
            UpperBoundTypeArgumentInference(pInterface, pDest.AsAggregateType());
            return true;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:44,代码来源:MethodTypeInferrer.cs

示例3: GetUserDefinedBinopArgumentType

 private AggregateType GetUserDefinedBinopArgumentType(CType type)
 {
     for (; ;)
     {
         switch (type.GetTypeKind())
         {
             case TypeKind.TK_NullableType:
                 type = type.StripNubs();
                 break;
             case TypeKind.TK_TypeParameterType:
                 type = type.AsTypeParameterType().GetEffectiveBaseClass();
                 break;
             case TypeKind.TK_AggregateType:
                 if ((type.isClassType() || type.isStructType()) && !type.AsAggregateType().getAggregate().IsSkipUDOps())
                 {
                     return type.AsAggregateType();
                 }
                 return null;
             default:
                 return null;
         }
     }
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:23,代码来源:Operators.cs


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