本文整理汇总了C#中IAssemblyInfo.GetReferencedAssemblies方法的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyInfo.GetReferencedAssemblies方法的具体用法?C# IAssemblyInfo.GetReferencedAssemblies怎么用?C# IAssemblyInfo.GetReferencedAssemblies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAssemblyInfo
的用法示例。
在下文中一共展示了IAssemblyInfo.GetReferencedAssemblies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAssemblyReference
/// <summary>
/// Finds the assembly name of the directly referenced assembly with the specified display name.
/// </summary>
/// <param name="assembly">The assembly to search.</param>
/// <param name="displayName">The display name of the referenced assembly to find.</param>
/// <returns>The referenced assembly name or null if none.</returns>
public static AssemblyName FindAssemblyReference(IAssemblyInfo assembly, string displayName)
{
foreach (AssemblyName reference in assembly.GetReferencedAssemblies())
{
if (reference.Name == displayName)
return reference;
}
return null;
}
示例2: GetExtensions
private IList<PatternTestFrameworkExtensionInfo> GetExtensions(IAssemblyInfo assembly)
{
var testFrameworkManager = RuntimeAccessor.ServiceLocator.Resolve<ITestFrameworkManager>();
var extensions = new List<PatternTestFrameworkExtensionInfo>();
IList<AssemblyName> assemblyReferences = assembly.GetReferencedAssemblies();
foreach (var testFrameworkHandle in testFrameworkManager.TestFrameworkHandles)
{
if (Array.IndexOf(testFrameworkIds, testFrameworkHandle.Id) < 0)
continue;
if (testFrameworkHandle.GetTraits().IsFrameworkCompatibleWithAssemblyReferences(assemblyReferences))
{
try
{
var testFramework = (PatternTestFramework) testFrameworkHandle.GetComponent();
extensions.AddRange(testFramework.GetExtensions(assembly));
}
catch (Exception ex)
{
UnhandledExceptionPolicy.Report(
"A pattern test framework extension threw an exception while enumerating referenced extensions for an assembly.",
ex);
}
}
}
extensions.Sort((a, b) => a.Id.CompareTo(b.Id));
return extensions;
}