本文整理汇总了C#中TypeWrapper.IsAccessibleFrom方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.IsAccessibleFrom方法的具体用法?C# TypeWrapper.IsAccessibleFrom怎么用?C# TypeWrapper.IsAccessibleFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeWrapper
的用法示例。
在下文中一共展示了TypeWrapper.IsAccessibleFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsAccessibleFrom
internal bool IsAccessibleFrom(TypeWrapper referencedType, TypeWrapper caller, TypeWrapper instance)
{
if(referencedType.IsAccessibleFrom(caller))
{
return (
caller == DeclaringType ||
IsPublicOrProtectedMemberAccessible(caller, instance) ||
(IsInternal && DeclaringType.InternalsVisibleTo(caller)) ||
(!IsPrivate && DeclaringType.IsPackageAccessibleFrom(caller)))
// The JVM supports accessing members that have non-public types in their signature from another package,
// but the CLI doesn't. It would be nice if we worked around that by emitting extra accessors, but for now
// we'll simply disallow such access across assemblies (unless the appropriate InternalsVisibleToAttribute exists).
&& (!(HasNonPublicTypeInSignature || IsType2FinalField) || InPracticeInternalsVisibleTo(caller));
}
return false;
}
示例2: IsSupportedInterface
private static bool IsSupportedInterface(TypeWrapper tw, TypeWrapper caller)
{
return tw.IsInterface
&& !tw.IsGhost
&& tw.IsAccessibleFrom(caller)
&& !Serialization.IsISerializable(tw);
}