当前位置: 首页>>代码示例>>C#>>正文


C# ImportDefinition.GetType方法代码示例

本文整理汇总了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";
        }
开发者ID:thecodejunkie,项目名称:MefContrib,代码行数:14,代码来源:CompositionServices.cs

示例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;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:ReflectionModelServices.cs

示例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);
        }
开发者ID:grothag,项目名称:pocketmef,代码行数:14,代码来源:ReflectionModelServices.cs

示例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;
        }
开发者ID:grothag,项目名称:pocketmef,代码行数:14,代码来源:ReflectionModelServices.cs

示例5: IsReflectionMemberImportDefinition

 public static bool IsReflectionMemberImportDefinition(ImportDefinition definition)
 {
     return definition.GetType().Name.Equals("ReflectionMemberImportDefinition");
 }
开发者ID:damonrpayne,项目名称:MefContrib,代码行数:4,代码来源:TypeHelper.cs

示例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;
        }
开发者ID:JackFong,项目名称:FreeRadical,代码行数:15,代码来源:ReflectionModelServices.cs


注:本文中的System.ComponentModel.Composition.Primitives.ImportDefinition.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。