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


C# TypeNode.IsStructurallyEquivalentTo方法代码示例

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


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

示例1: IsAssignableToInstanceOf

 /// <summary>
 /// Returns true if this type is assignable to some instance of the given template.
 /// </summary>
 public virtual bool IsAssignableToInstanceOf(TypeNode targetTemplate)
 {
     if(this == CoreSystemTypes.Void || targetTemplate == null)
         return false;
     if(targetTemplate.IsStructurallyEquivalentTo(this.Template == null ? this : this.Template) ||
       this.BaseType != null && (this.BaseType.IsAssignableToInstanceOf(targetTemplate) ||
       this.BaseType.Template != null && this.BaseType.Template.IsAssignableToInstanceOf(targetTemplate)))
         return true;
     InterfaceList interfaces = this.Interfaces;
     if(interfaces == null)
         return false;
     for(int i = 0, n = interfaces.Count; i < n; i++)
     {
         Interface iface = interfaces[i];
         if(iface == null)
             continue;
         if(iface.IsAssignableToInstanceOf(targetTemplate))
             return true;
     }
     return false;
 }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:24,代码来源:Nodes.cs

示例2: TypeMatch

        private static bool TypeMatch(TypeNode type1, TypeNode type2) {

            // the two types must be of the same kind
            if (type1.NodeType != type2.NodeType) return (false);

            if (type1.NodeType == NodeType.ArrayType) {
                // they are arrays, so check elements
                ArrayType array1 = (ArrayType)type1;
                ArrayType array2 = (ArrayType)type2;
                return (TypeMatch(array1.ElementType, array2.ElementType));
            } else {
                // they are normal types
                return (type1.IsStructurallyEquivalentTo(type2));
            }
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:15,代码来源:Reflection.cs

示例3: GetImplicitCoercionFromMethod

 public virtual Method GetImplicitCoercionFromMethod(TypeNode sourceType)
 {
     if(sourceType == null)
         return null;
     Method result = null;
     if(this.implicitCoercionFromTable != null)
         result = (Method)this.implicitCoercionFromTable[sourceType.UniqueKey];
     if(result == TypeNode.MethodDoesNotExist)
         return null;
     if(result != null)
         return result;
     lock(this)
     {
         if(this.implicitCoercionFromTable != null)
             result = (Method)this.implicitCoercionFromTable[sourceType.UniqueKey];
         if(result == TypeNode.MethodDoesNotExist)
             return null;
         if(result != null)
             return result;
         MemberList coercions = this.ImplicitCoercionMethods;
         for(int i = 0, n = coercions.Count; i < n; i++)
         {
             Method m = (Method)coercions[i];
             if(sourceType.IsStructurallyEquivalentTo(TypeNode.StripModifiers(m.Parameters[0].Type))) { result = m; break; }
         }
         if(this.implicitCoercionFromTable == null)
             this.implicitCoercionFromTable = new TrivialHashtable();
         if(result == null)
             this.implicitCoercionFromTable[sourceType.UniqueKey] = TypeNode.MethodDoesNotExist;
         else
             this.implicitCoercionFromTable[sourceType.UniqueKey] = result;
         return result;
     }
 }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:34,代码来源:Nodes.cs


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