本文整理匯總了C#中System.ComponentModel.Composition.Primitives.ComposablePartDefinition.IsGeneric方法的典型用法代碼示例。如果您正苦於以下問題:C# ComposablePartDefinition.IsGeneric方法的具體用法?C# ComposablePartDefinition.IsGeneric怎麽用?C# ComposablePartDefinition.IsGeneric使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ComponentModel.Composition.Primitives.ComposablePartDefinition
的用法示例。
在下文中一共展示了ComposablePartDefinition.IsGeneric方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TryTraverse
public bool TryTraverse(ComposablePartDefinition part, out IEnumerable<ComposablePartDefinition> reachableParts)
{
reachableParts = null;
List<ComposablePartDefinition> reachablePartList = null;
// Go through all part exports
foreach (ExportDefinition export in part.ExportDefinitions)
{
// Find all parts that we know will import each export
List<ComposablePartDefinition> candidateReachableParts = null;
if (this._importersIndex.TryGetValue(export.ContractName, out candidateReachableParts))
{
// find if they actually match
foreach (var candidateReachablePart in candidateReachableParts)
{
foreach (ImportDefinition import in candidateReachablePart.ImportDefinitions.Where(this._importFilter))
{
if (import.IsImportDependentOnPart(part, export, part.IsGeneric() != candidateReachablePart.IsGeneric()))
{
if (reachablePartList == null)
{
reachablePartList = new List<ComposablePartDefinition>();
}
reachablePartList.Add(candidateReachablePart);
}
}
}
}
}
reachableParts = reachablePartList;
return (reachableParts != null);
}