當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。