本文整理汇总了C#中Module.ContainsModule方法的典型用法代码示例。如果您正苦于以下问题:C# Module.ContainsModule方法的具体用法?C# Module.ContainsModule怎么用?C# Module.ContainsModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module.ContainsModule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalsAreVisible
public static bool InternalsAreVisible(Module referringModule, Module declaringModule) {
if (referringModule == declaringModule) return true;
if (referringModule == null || declaringModule == null) return false;
AssemblyNode referringAssembly = referringModule.ContainingAssembly;
if (referringAssembly == null) referringAssembly = referringModule as AssemblyNode;
AssemblyNode declaringAssembly = declaringModule.ContainingAssembly;
if (declaringAssembly == null) declaringAssembly = declaringModule as AssemblyNode;
if (referringAssembly == declaringAssembly) return true;
if (referringAssembly == null) return referringModule.ContainsModule(declaringModule);
if (referringAssembly.ContainsModule(declaringModule)) return true;
return referringAssembly.MayAccessInternalTypesOf(declaringAssembly);
}
示例2: MayAccessInternals
protected virtual bool MayAccessInternals(Module referringModule, TypeNode referredToType) {
if (referringModule == null || referredToType == null) return false;
Module referredToModule = referredToType.DeclaringModule;
if (referredToModule == null) return false;
if (referringModule == referredToModule) return true;
AssemblyNode referringAssembly = referringModule.ContainingAssembly;
AssemblyNode referredToAssembly = referredToModule.ContainingAssembly;
if (referringAssembly == null) referringAssembly = referringModule as AssemblyNode;
if (referredToAssembly == null) referredToAssembly = referredToModule as AssemblyNode;
if (referringAssembly == null) return referringModule.ContainsModule(referredToModule);
if (referringAssembly == referredToAssembly) return true;
if (referringAssembly.ContainsModule(referringModule)) return true;
return referringAssembly.MayAccessInternalTypesOf(referredToAssembly);
}