本文整理匯總了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;
}