本文整理汇总了C#中System.ComponentModel.Composition.Primitives.ImportDefinition.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ImportDefinition.GetType方法的具体用法?C# ImportDefinition.GetType怎么用?C# ImportDefinition.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ComponentModel.Composition.Primitives.ImportDefinition
的用法示例。
在下文中一共展示了ImportDefinition.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsReflectionImportDefinition
/// <summary>
/// Checks if the given <see cref="ImportDefinition"/> is based on reflection model.
/// </summary>
/// <param name="definition">The <see cref="ImportDefinition"/> instance.</param>
/// <returns><c>True</c> if the given import definition is based on the
/// reflection model. <c>False</c> otherwise.</returns>
public static bool IsReflectionImportDefinition(ImportDefinition definition)
{
if (definition == null) throw new ArgumentNullException("definition");
var name = definition.GetType().Name;
return name == "ReflectionMemberImportDefinition" ||
name == "ReflectionParameterImportDefinition";
}
示例2: GetImportingMember
public static LazyMemberInfo GetImportingMember(ImportDefinition importDefinition)
{
Requires.NotNull(importDefinition, "importDefinition");
ReflectionMemberImportDefinition reflectionMemberImportDefinition = importDefinition as ReflectionMemberImportDefinition;
if (reflectionMemberImportDefinition == null)
{
throw new ArgumentException(
string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidMemberImportDefinition, importDefinition.GetType()),
"importDefinition");
}
return reflectionMemberImportDefinition.ImportingLazyMember;
}
示例3: IsPartCreatorImportDefinition
public static bool IsPartCreatorImportDefinition(ImportDefinition importDefinition)
{
Requires.NotNull(importDefinition, "importDefinition");
ReflectionImportDefinition reflectionImportDefinition = importDefinition as ReflectionImportDefinition;
if (reflectionImportDefinition == null)
{
throw new ArgumentException(
string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
"importDefinition");
}
return (importDefinition is IPartCreatorImportDefinition);
}
示例4: GetPartCreatorProductImportDefinition
public static ContractBasedImportDefinition GetPartCreatorProductImportDefinition(ImportDefinition importDefinition)
{
Requires.NotNull(importDefinition, "importDefinition");
IPartCreatorImportDefinition partCreatorImportDefinition = importDefinition as IPartCreatorImportDefinition;
if (partCreatorImportDefinition == null)
{
throw new ArgumentException(
string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
"importDefinition");
}
return partCreatorImportDefinition.ProductImportDefinition;
}
示例5: IsReflectionMemberImportDefinition
public static bool IsReflectionMemberImportDefinition(ImportDefinition definition)
{
return definition.GetType().Name.Equals("ReflectionMemberImportDefinition");
}
示例6: GetImportingParameter
public static Lazy<ParameterInfo> GetImportingParameter(ImportDefinition importDefinition)
{
Requires.NotNull(importDefinition, "importDefinition");
Contract.Ensures(Contract.Result<Lazy<ParameterInfo>>() != null);
ReflectionParameterImportDefinition reflectionParameterImportDefinition = importDefinition as ReflectionParameterImportDefinition;
if (reflectionParameterImportDefinition == null)
{
throw new ArgumentException(
string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidParameterImportDefinition, importDefinition.GetType()),
"importDefinition");
}
return reflectionParameterImportDefinition.ImportingLazyParameter;
}