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


C# Type.IsEquivalentTo方法代码示例

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


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

示例1: AreEquivalent

        internal static bool AreEquivalent(Type t1, Type t2)
        {
#if CLR2 || SILVERLIGHT
            return t1 == t2;
#else
            return t1 == t2 || t1.IsEquivalentTo(t2);
#endif
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:8,代码来源:TypeUtils.cs

示例2: AreTypesEquivalent

        /// <summary>
        /// Determines if two CLR types are equivalent.
        /// </summary>
        /// <param name="typeA">First type to compare.</param>
        /// <param name="typeB">Second type to compare.</param>
        /// <returns>true if the types are equivalent (they both represent the same type), or false otherwise.</returns>
        /// <remarks>This method abstracts away the necessity to call Type.IsEquivalentTo method in .NET 4 and higher but 
        /// use simple reference equality on platforms which don't have that method (like Silverlight).</remarks>
        internal static bool AreTypesEquivalent(Type typeA, Type typeB)
        {
            DebugUtils.CheckNoExternalCallers();

            if (typeA == null || typeB == null)
            {
                return false;
            }
            else
            {
#if SILVERLIGHT || WINDOWS_PHONE || ORCAS
                return typeA == typeB;
#else
                return typeA.IsEquivalentTo(typeB);
#endif
            }
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:25,代码来源:TypeUtils.cs

示例3: AreEquivalent

 public static bool AreEquivalent(Type t1, Type t2)
 {
     return t1.IsEquivalentTo(t2);
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:TypeUtils.cs

示例4: GetMethod

 /// <summary>
 /// Find ApplyTo method.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="exact"></param>
 /// <returns></returns>
 internal static MethodInfo GetMethod(Type type, bool exact)
 {
     var methods = typeof(Theme).GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
     foreach (var method in methods)
     {
         if (method.Name != "ApplyTo")
             continue;
         var @params = method.GetParameters();
         if (@params.Length == 1 &&
             exact ? type.IsEquivalentTo(@params[0].ParameterType)
                   : type.IsSubclassOf(@params[0].ParameterType))
             return method;
     }
     return null;
 }
开发者ID:h3tch,项目名称:ProtoFX,代码行数:21,代码来源:Theme.cs

示例5: AreEquivalent

        internal static bool AreEquivalent(Type t1, Type t2)
        {
#if MICROSOFT_SCRIPTING_CORE || SILVERLIGHT
            return t1 == t2;
#else
            return t1 == t2 || t1.IsEquivalentTo(t2);
#endif
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:8,代码来源:TypeUtils.cs

示例6: AreEquivalent

        internal static bool AreEquivalent(Type t1, Type t2) {
#if FEATURE_TYPE_EQUIVALENCE
            return t1 == t2 || t1.IsEquivalentTo(t2);
#else
            return t1 == t2;
#endif
        }
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:TypeUtils.cs


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