本文整理汇总了C#中ITypeElement.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeElement.IsValid方法的具体用法?C# ITypeElement.IsValid怎么用?C# ITypeElement.IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeElement
的用法示例。
在下文中一共展示了ITypeElement.IsValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateAssemblyTypes
private void PopulateAssemblyTypes(List<StaticDeclaredTypeWrapper> types, ITypeElement typeHandle, bool includeNonPublicTypes)
{
if (!typeHandle.IsValid())
return;
IModifiersOwner modifiers = typeHandle as IModifiersOwner;
if (modifiers != null && (includeNonPublicTypes || modifiers.GetAccessRights() == AccessRights.PUBLIC))
{
types.Add(MakeDeclaredTypeWithoutSubstitution(typeHandle));
foreach (ITypeElement nestedType in typeHandle.NestedTypes)
PopulateAssemblyTypes(types, nestedType, includeNonPublicTypes);
}
}
示例2: SafeGetSuperTypes
/// <summary>
/// It is possible for GetSuperTypes to return types that would form a cycle
/// if the user typed in something like "class A : A" (even accidentally).
/// This will cause big problems down the line so we drop supertypes with cycles.
/// </summary>
private static IEnumerable<IDeclaredType> SafeGetSuperTypes(ITypeElement typeElement)
{
if (!typeElement.IsValid())
yield break;
IList<IDeclaredType> superTypes = typeElement.GetSuperTypes();
if (superTypes.Count == 0)
yield break;
foreach (IDeclaredType superType in typeElement.GetSuperTypes())
{
#if RESHARPER_31 || RESHARPER_40 || RESHARPER_41
if (superType.IsValid)
#else
if (superType.IsValid())
#endif
{
ITypeElement superTypeElement = superType.GetTypeElement();
if (superTypeElement.IsValid())
{
if (!HasSuperTypeCycle(superTypeElement))
yield return superType;
}
}
}
}