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


C# INamedTypeSymbol.GetBaseTypes方法代码示例

本文整理汇总了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();
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:16,代码来源:ICodeDefinitionFactoryExtensions_CreateEqualsMethod.cs

示例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);
        }
开发者ID:duracellko,项目名称:roslyn-analyzers,代码行数:18,代码来源:NestedTypesShouldNotBeVisible.cs

示例3: GetEventSourceBaseTypeInfo

 private EventSourceTypeInfo GetEventSourceBaseTypeInfo(INamedTypeSymbol sourceClass)
 {
    return EventSourceTypes.FirstOrDefault(est => sourceClass.GetBaseTypes().Any(c => est.EventSourceClass.Equals(c)));
 }
开发者ID:modulexcite,项目名称:EventSourceGenerator-1,代码行数:4,代码来源:EventSourceGenerator.cs

示例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);
        }
开发者ID:Anniepoh,项目名称:roslyn-analyzers,代码行数:19,代码来源:NestedTypesShouldNotBeVisible.cs


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