本文整理汇总了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;
}
示例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;
}