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


C# Reflector.ToString方法代码示例

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


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

示例1: IsEqual

 public static bool IsEqual(Reflector.CodeModel.IType t, TypeReference tr)
 {
     if (t is Reflector.CodeModel.ITypeReference)
     {
         return IsEqual((Reflector.CodeModel.ITypeReference)t, tr);
     }
     else if ((t is Reflector.CodeModel.IArrayType) && (tr is ArrayType))
     {
         Reflector.CodeModel.IArrayType t2 = (Reflector.CodeModel.IArrayType)t;
         ArrayType tr2 = (ArrayType)tr;
         if (
             !(t2.Dimensions.Count == 0 && tr2.Dimensions.Count == 1) // one dimension
             && (t2.Dimensions.Count != tr2.Dimensions.Count) // two or more dimension 
             ) return false;
         
         return IsEqual(t2.ElementType, tr2.ElementType);
     }
     else if ((t is Reflector.CodeModel.IReferenceType) && (tr is ByReferenceType))
     {
         return IsEqual(((Reflector.CodeModel.IReferenceType)t).ElementType, ((ByReferenceType)tr).ElementType);
     }
     else if ((t is Reflector.CodeModel.IPointerType) && (tr is PointerType))
     {
         return IsEqual(((Reflector.CodeModel.IPointerType)t).ElementType, ((PointerType)tr).ElementType);
     }
     else if ((t is Reflector.CodeModel.IOptionalModifier) && (tr is OptionalModifierType))
     {
         Reflector.CodeModel.IOptionalModifier t2 = (Reflector.CodeModel.IOptionalModifier)t;
         OptionalModifierType tr2 = (OptionalModifierType)tr;
         return IsEqual(t2.Modifier, tr2.ModifierType) && IsEqual(t2.ElementType, tr2.ElementType);
     }
     else if ((t is Reflector.CodeModel.IFunctionPointer) && (tr is FunctionPointerType))
     {
         Reflector.CodeModel.IFunctionPointer t2 = (Reflector.CodeModel.IFunctionPointer)t;
         FunctionPointerType tr2 = (FunctionPointerType)tr;
         if (t2.Parameters.Count == tr2.Parameters.Count && IsEqual(t2.ReturnType.Type, tr2.ReturnType))
         {
             for (int i = 0; i < t2.Parameters.Count; i++)
             {
                 if (!IsEqual(t2.Parameters[i].ParameterType, tr2.Parameters[i].ParameterType))
                     return false;
             }
             return true;
         }
         return false;
     }
     else if ((t is Reflector.CodeModel.IRequiredModifier) && (tr is RequiredModifierType))
     {
         Reflector.CodeModel.IRequiredModifier t2 = (Reflector.CodeModel.IRequiredModifier)t;
         RequiredModifierType tr2 = (RequiredModifierType)tr;
         return IsEqual(t2.Modifier, tr2.ModifierType) && IsEqual(t2.ElementType, tr2.ElementType);
     }
     else
     {
         string trName = InsUtils.GetOldMemberName(tr);
         //when tr is GenericParameter, it may be !0 or something, no clue what it is, no luck ...
         if ("!0" == trName && t.ToString() == "T")
             return true;
         return t.ToString().Equals(trName);
     }
 }
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:61,代码来源:CecilHelper.cs


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