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


C# ITypeProvider.GetTypes方法代码示例

本文整理汇总了C#中ITypeProvider.GetTypes方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeProvider.GetTypes方法的具体用法?C# ITypeProvider.GetTypes怎么用?C# ITypeProvider.GetTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITypeProvider的用法示例。


在下文中一共展示了ITypeProvider.GetTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTargetFrameworkTypes

        List<Type> GetTargetFrameworkTypes(ITypeProvider currentTypeProvider)
        {
            IExtendedUIService2 extendedUIService = (IExtendedUIService2)this.serviceProvider.GetService(typeof(IExtendedUIService2));
            List<Type> targetFrameworkTypes = new List<Type>();
            if (currentTypeProvider != null)
            {
                if (extendedUIService != null)
                {
                    List<Assembly> runtimeAssemblies = new List<Assembly>(currentTypeProvider.ReferencedAssemblies);
                    foreach (Assembly runtimeAssembly in runtimeAssemblies)
                    {
                        Assembly reflectionContextAssembly = extendedUIService.GetReflectionAssembly(runtimeAssembly.GetName());
                        if (reflectionContextAssembly != null)
                        {
                            foreach (Type type in reflectionContextAssembly.GetTypes())
                            {
                                if (type.IsPublic)
                                {
                                    targetFrameworkTypes.Add(type);
                                }
                            }
                        }
                    }

                    // add design time types from type provider to the list 
                    // and design time types are only for the current user assemblies.
                    foreach (Type type in currentTypeProvider.GetTypes())
                    {
                        if (type.Assembly == null)
                        {
                            targetFrameworkTypes.Add(type);
                        }
                    }
                    
                }
                else
                {
                    //if extendedUIService is null fall back to the type provider.
                    targetFrameworkTypes.AddRange(currentTypeProvider.GetTypes());
                }
            }
            return targetFrameworkTypes;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:43,代码来源:TypeBrowserDialog.cs

示例2: GetTargetFrameworkTypes

 private List<System.Type> GetTargetFrameworkTypes(ITypeProvider currentTypeProvider)
 {
     IExtendedUIService2 service = (IExtendedUIService2) this.serviceProvider.GetService(typeof(IExtendedUIService2));
     List<System.Type> list = new List<System.Type>();
     if (currentTypeProvider != null)
     {
         if (service != null)
         {
             List<Assembly> list2 = new List<Assembly>(currentTypeProvider.ReferencedAssemblies);
             foreach (Assembly assembly in list2)
             {
                 Assembly reflectionAssembly = service.GetReflectionAssembly(assembly.GetName());
                 if (reflectionAssembly != null)
                 {
                     foreach (System.Type type in reflectionAssembly.GetTypes())
                     {
                         if (type.IsPublic)
                         {
                             list.Add(type);
                         }
                     }
                 }
             }
             foreach (System.Type type2 in currentTypeProvider.GetTypes())
             {
                 if (type2.Assembly == null)
                 {
                     list.Add(type2);
                 }
             }
             return list;
         }
         list.AddRange(currentTypeProvider.GetTypes());
     }
     return list;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:36,代码来源:TypeBrowserDialog.cs


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