本文整理汇总了C#中INamedTypeSymbol.GetBaseTypes方法的典型用法代码示例。如果您正苦于以下问题:C# INamedTypeSymbol.GetBaseTypes方法的具体用法?C# INamedTypeSymbol.GetBaseTypes怎么用?C# INamedTypeSymbol.GetBaseTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INamedTypeSymbol
的用法示例。
在下文中一共展示了INamedTypeSymbol.GetBaseTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasExistingBaseEqualsMethod
private static bool HasExistingBaseEqualsMethod(INamedTypeSymbol containingType, CancellationToken cancellationToken)
{
// Check if any of our base types override Equals. If so, first check with them.
var existingMethods =
from baseType in containingType.GetBaseTypes()
from method in baseType.GetMembers(EqualsName).OfType<IMethodSymbol>()
where method.IsOverride &&
method.DeclaredAccessibility == Accessibility.Public &&
!method.IsStatic &&
method.Parameters.Length == 1 &&
method.ReturnType.SpecialType == SpecialType.System_Boolean &&
method.Parameters[0].Type.SpecialType == SpecialType.System_Object
select method;
return existingMethods.Any();
}
示例2: IsDataSetSpecialCase
// When you use the Visual Studio Dataset Designer to add a DataTable to a DataSet, the
// designer generates two public nested types within the DataSet: a DataTable and a DataRow.
// Since these are generated code, we don't want to fire on them.
private static bool IsDataSetSpecialCase(
INamedTypeSymbol containingType,
INamedTypeSymbol nestedType,
INamedTypeSymbol dataSetType,
INamedTypeSymbol dataTableType,
INamedTypeSymbol dataRowType)
{
if (!containingType.GetBaseTypes().Contains(dataSetType))
{
return false;
}
var nestedTypeBases = nestedType.GetBaseTypes().ToList();
return nestedTypeBases.Contains(dataTableType) || nestedTypeBases.Contains(dataRowType);
}
示例3: GetEventSourceBaseTypeInfo
private EventSourceTypeInfo GetEventSourceBaseTypeInfo(INamedTypeSymbol sourceClass)
{
return EventSourceTypes.FirstOrDefault(est => sourceClass.GetBaseTypes().Any(c => est.EventSourceClass.Equals(c)));
}
示例4: IsDataSetSpecialCase
// When you use the Visual Studio Dataset Designer to add a DataTable to a DataSet, the
// designer generates two public nested types within the DataSet: a DataTable and a DataRow.
// Since these are generated code, we don't want to fire on them.
private bool IsDataSetSpecialCase(
INamedTypeSymbol containingType,
INamedTypeSymbol nestedType,
INamedTypeSymbol dataSetType,
INamedTypeSymbol dataTableType,
INamedTypeSymbol dataRowType)
{
if (!containingType.GetBaseTypes().Contains(dataSetType))
{
return false;
}
System.Collections.Generic.List<INamedTypeSymbol> nestedTypeBases = nestedType.GetBaseTypes().ToList();
return nestedTypeBases.Contains(dataTableType) || nestedTypeBases.Contains(dataRowType);
}