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


C# MemberDeclarationSyntax.GetModifiers方法代码示例

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


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

示例1: ShouldUseOverrideKeyword

        private static bool ShouldUseOverrideKeyword(MemberDeclarationSyntax member, bool isInterface)
        {
            ISymbol symbol = TypeProcessor.GetDeclaredSymbol(member);

            if (symbol is IMethodSymbol)
            {
                if ((symbol as IMethodSymbol).IsGenericMethod)
                    return false;
            }

            if (symbol.ContainingType.TypeKind == TypeKind.Struct ||
                symbol.ContainingType.TypeKind == TypeKind.Interface)
            {
                return false;
                // Structs dont have a base class to override (maybe opEquals) ... but that will be handled separately
                //Interfaces are contracts, so no overriding here// maybe we should compare the methods 
            }

            if (member.GetModifiers().Any(SyntaxKind.OverrideKeyword) && !isInterface)
                return true;


            if (member.GetModifiers().Any(SyntaxKind.StaticKeyword))
                return false;
            //          if (method.Modifiers.Any(SyntaxKind.NewKeyword))
            //              return  symbol.ContainingType.BaseType.GetMembers(symbol.Name).Any(k=>k.IsAbstract || k.IsVirtual);

            if (member.GetModifiers().Any(SyntaxKind.PartialKeyword))
                //partial methods seem exempt from C#'s normal override keyword requirement, so we have to check manually to see if it exists in a base class
                return symbol.ContainingType.BaseType.GetMembers(symbol.Name).Any();

            return member.GetModifiers().Any(SyntaxKind.OverrideKeyword);
        }
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:33,代码来源:MemberUtilities.cs

示例2: MemberOrderHelper

        /// <summary>
        /// Initializes a new instance of the <see cref="MemberOrderHelper"/> struct.
        /// </summary>
        /// <param name="member">The member to wrap.</param>
        public MemberOrderHelper(MemberDeclarationSyntax member)
        {
            this.Member = member;
            var modifiers = member.GetModifiers();

            this.modifierFlags = GetModifierFlags(modifiers);
            this.accessibilty = AccessLevelHelper.GetAccessLevel(modifiers);
        }
开发者ID:robinsedlaczek,项目名称:StyleCopAnalyzers,代码行数:12,代码来源:MemberOrderHelper.cs

示例3: MemberOrderHelper

        /// <summary>
        /// Initializes a new instance of the <see cref="MemberOrderHelper"/> struct.
        /// </summary>
        /// <param name="member">The member to wrap.</param>
        /// <param name="elementOrder">The element ordering traits.</param>
        internal MemberOrderHelper(MemberDeclarationSyntax member, ImmutableArray<OrderingTrait> elementOrder)
        {
            this.Member = member;
            var modifiers = member.GetModifiers();
            var type = member.Kind();
            type = type == SyntaxKind.EventFieldDeclaration ? SyntaxKind.EventDeclaration : type;

            this.Priority = 0;
            foreach (OrderingTrait trait in elementOrder)
            {
                switch (trait)
                {
                case OrderingTrait.Kind:
                    // 4 bits are required to store this.
                    this.Priority <<= 4;
                    this.Priority |= TypeMemberOrder.IndexOf(type) & 0x0F;
                    break;

                case OrderingTrait.Accessibility:
                    // 3 bits are required to store this.
                    this.Priority <<= 3;
                    this.Priority |= (int)GetAccessLevelForOrdering(member, modifiers) & 0x07;
                    break;

                case OrderingTrait.Constant:
                    this.Priority <<= 1;
                    if (modifiers.Any(SyntaxKind.ConstKeyword))
                    {
                        this.Priority |= 1;
                    }

                    break;

                case OrderingTrait.Static:
                    this.Priority <<= 1;
                    if (modifiers.Any(SyntaxKind.StaticKeyword))
                    {
                        this.Priority |= 1;
                    }

                    break;

                case OrderingTrait.Readonly:
                    this.Priority <<= 1;
                    if (modifiers.Any(SyntaxKind.ReadOnlyKeyword))
                    {
                        this.Priority |= 1;
                    }

                    break;

                default:
                    continue;
                }
            }
        }
开发者ID:Romanx,项目名称:StyleCopAnalyzers,代码行数:61,代码来源:MemberOrderHelper.cs

示例4: GetAccessModifiers

        public static string GetAccessModifiers(MemberDeclarationSyntax member, bool isInterface)
        {
            bool isStatic;
            var acccessmodifiers = "";
            var modifiers = member.GetModifiers();
            bool isoverride = ShouldUseOverrideKeyword(member, isInterface);



            if (modifiers.Any(SyntaxKind.PublicKeyword) || modifiers.Any(SyntaxKind.InternalKeyword) ||
                modifiers.Any(SyntaxKind.ProtectedKeyword) || modifiers.Any(SyntaxKind.AbstractKeyword) ||
                isInterface)
                acccessmodifiers += ("public ");

            if (!modifiers.Any(SyntaxKind.VirtualKeyword) && !isInterface && !isoverride)
                acccessmodifiers += ("final ");

            ///  if (modifiers.Any(SyntaxKind.PrivateKeyword)) // Reflection cannot work with this, cant get address or set value
            //     acccessmodifiers += ("private ");


            if (modifiers.Any(SyntaxKind.StaticKeyword))
            {
                acccessmodifiers += "static ";
            }

            if (member.GetModifiers().Any(SyntaxKind.AbstractKeyword))
                acccessmodifiers += "abstract ";




            if (isoverride)
                acccessmodifiers += ("override ");

            return acccessmodifiers;
        }
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:37,代码来源:MemberUtilities.cs

示例5: MemberOrderHelper

        /// <summary>
        /// Initializes a new instance of the <see cref="MemberOrderHelper"/> struct.
        /// </summary>
        /// <param name="member">The member to wrap.</param>
        /// <param name="checks">The element ordering checks.</param>
        internal MemberOrderHelper(MemberDeclarationSyntax member, ElementOrderingChecks checks)
        {
            this.Member = member;
            var modifiers = member.GetModifiers();
            var type = member.Kind();
            type = type == SyntaxKind.EventFieldDeclaration ? SyntaxKind.EventDeclaration : type;

            this.elementPriority = checks.ElementType ? TypeMemberOrder.IndexOf(type) : 0;
            this.modifierFlags = GetModifierFlags(modifiers, checks);
            if (checks.AccessLevel)
            {
                if ((type == SyntaxKind.ConstructorDeclaration && this.modifierFlags.HasFlag(ModifierFlags.Static))
                    || (type == SyntaxKind.MethodDeclaration && ((MethodDeclarationSyntax)member).ExplicitInterfaceSpecifier != null)
                    || (type == SyntaxKind.PropertyDeclaration && ((PropertyDeclarationSyntax)member).ExplicitInterfaceSpecifier != null)
                    || (type == SyntaxKind.IndexerDeclaration && ((IndexerDeclarationSyntax)member).ExplicitInterfaceSpecifier != null))
                {
                    this.accessibilty = AccessLevel.Public;
                }
                else
                {
                    this.accessibilty = AccessLevelHelper.GetAccessLevel(modifiers);
                    if (this.accessibilty == AccessLevel.NotSpecified)
                    {
                        if (member.Parent.IsKind(SyntaxKind.CompilationUnit) || member.Parent.IsKind(SyntaxKind.NamespaceDeclaration))
                        {
                            this.accessibilty = AccessLevel.Internal;
                        }
                        else
                        {
                            this.accessibilty = AccessLevel.Private;
                        }
                    }
                }
            }
            else
            {
                this.accessibilty = AccessLevel.Public;
            }
        }
开发者ID:hexuefengx,项目名称:StyleCopAnalyzers,代码行数:44,代码来源:MemberOrderHelper.cs

示例6: ReplaceDeclarationModifiers

        private static MemberDeclarationSyntax ReplaceDeclarationModifiers(MemberDeclarationSyntax declaration, List<SyntaxToken> oldAccessibilityModifiers, SyntaxTokenList newAccessibilityModifiers)
        {
            var result = declaration;
            var replacedModifiers = declaration.GetModifiers();

            if (oldAccessibilityModifiers.Count == 0)
            {
                replacedModifiers = replacedModifiers.InsertRange(0,newAccessibilityModifiers);
            }
            else if(oldAccessibilityModifiers.Count == 1)
            {
                replacedModifiers = replacedModifiers.ReplaceRange(oldAccessibilityModifiers[0], newAccessibilityModifiers);
            }
            else if(oldAccessibilityModifiers.Count == 2)
            {
                replacedModifiers = replacedModifiers.ReplaceRange(oldAccessibilityModifiers[0], newAccessibilityModifiers);
                replacedModifiers = replacedModifiers.Remove(replacedModifiers.SingleOrDefault(token => token.IsKind(oldAccessibilityModifiers[1].Kind())));
            }

            result = declaration.WithModifiers(replacedModifiers);

            return result;
        }
开发者ID:nagyistoce,项目名称:code-cracker,代码行数:23,代码来源:InconsistentAccessibilityCodeFixProvider.cs

示例7: GetAccessibilityModifiersFromMember

 private static IEnumerable<SyntaxToken> GetAccessibilityModifiersFromMember(MemberDeclarationSyntax member) => member.GetModifiers().Where(token => token.IsKind(SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PrivateKeyword));
开发者ID:nagyistoce,项目名称:code-cracker,代码行数:1,代码来源:InconsistentAccessibilityCodeFixProvider.cs

示例8: ChangeAccessibilityModifiersInDeclaration

        private static MemberDeclarationSyntax ChangeAccessibilityModifiersInDeclaration(MemberDeclarationSyntax declaration, SyntaxTokenList newAccessibilityModifiers)
        {
            var newDeclaration = declaration;

            var actualTypeAccessibilityModifiers = GetAccessibilityModifiersFromMember(declaration);
            var hasAccessibilityModifiers = actualTypeAccessibilityModifiers.Any();

            var leadingTrivias = default(SyntaxTriviaList);
            var trailingTrivias = default(SyntaxTriviaList);
            if (!hasAccessibilityModifiers)
            {
                var modifiers = declaration.GetModifiers();
                if (modifiers.Count > 0)
                {
                    var firstModifier = modifiers.First();
                    leadingTrivias = firstModifier.LeadingTrivia;
                    newDeclaration = RemoveLeadingTriviasFromFirstDeclarationModifier(declaration, modifiers, firstModifier);
                }
                else
                {
                    leadingTrivias = declaration.GetLeadingTrivia();
                    newDeclaration = RemoveLeadingTriviasFromDeclaration(declaration);
                }
                trailingTrivias = SyntaxFactory.TriviaList(SyntaxFactory.Space);
            }
            else
            {
                leadingTrivias = actualTypeAccessibilityModifiers.First().LeadingTrivia;
                trailingTrivias = GetAllTriviasAfterFirstModifier(actualTypeAccessibilityModifiers);
            }

            newAccessibilityModifiers = MergeActualTriviasIntoNewAccessibilityModifiers(newAccessibilityModifiers, leadingTrivias, trailingTrivias);

            newDeclaration = ReplaceDeclarationModifiers(newDeclaration, actualTypeAccessibilityModifiers.ToList(), newAccessibilityModifiers);

            return newDeclaration;
        }
开发者ID:nagyistoce,项目名称:code-cracker,代码行数:37,代码来源:InconsistentAccessibilityCodeFixProvider.cs

示例9: IsAltered

 bool IsAltered(SemanticModel model, MemberDeclarationSyntax member, ISymbol symbol, CancellationToken token, out bool wasUsed)
 {
     wasUsed = false;
     foreach (var usage in member.DescendantNodesAndSelf().Where(n => n.IsKind(SyntaxKind.IdentifierName)).OfType<ExpressionSyntax>())
     {
         var info = model.GetSymbolInfo(usage).Symbol;
         if (info == symbol)
             wasUsed = true;
         if (!usage.IsWrittenTo())
             continue;
         if (member.IsKind(SyntaxKind.ConstructorDeclaration) && !usage.Ancestors().Any(a => a.IsKind(SyntaxKind.AnonymousMethodExpression) || a.IsKind(SyntaxKind.SimpleLambdaExpression) || a.IsKind(SyntaxKind.ParenthesizedLambdaExpression)))
         {
             if (member.GetModifiers().Any(m => m.IsKind(SyntaxKind.StaticKeyword)) == info.IsStatic)
                 continue;
         }
         if (info == symbol)
             return true;
     }
     return false;
 }
开发者ID:yeaicc,项目名称:RefactoringEssentials,代码行数:20,代码来源:FieldCanBeMadeReadOnlyAnalyzer.cs

示例10: AddModifier

        static SyntaxNode AddModifier(MemberDeclarationSyntax abstractDeclaration, SyntaxKind token)
        {
            var method = abstractDeclaration as MethodDeclarationSyntax;

            var modifier = abstractDeclaration.GetModifiers();
            var newMods = modifier.Where(m => !m.IsKind(SyntaxKind.AbstractKeyword) && !m.IsKind(SyntaxKind.StaticKeyword));

            newMods = newMods.Concat(
                new[] { SyntaxFactory.Token(token) }
            );

            var newModifier = SyntaxFactory.TokenList(newMods);

            if (method != null)
            {
                return method.WithModifiers(newModifier);
            }

            var property = abstractDeclaration as PropertyDeclarationSyntax;
            if (property != null)
            {
                return property.WithModifiers(newModifier);
            }

            var indexer = abstractDeclaration as IndexerDeclarationSyntax;
            if (indexer != null)
            {
                return indexer.WithModifiers(newModifier);
            }

            var evt = abstractDeclaration as EventDeclarationSyntax;
            if (evt != null)
            {
                return evt.WithModifiers(newModifier);
            }

            var evt2 = abstractDeclaration as EventFieldDeclarationSyntax;
            if (evt2 != null)
            {
                return evt2.WithModifiers(newModifier);
            }
            return null;
        }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:43,代码来源:ToAbstractVirtualNonVirtualConversionCodeRefactoringProvider.cs

示例11: MakeAbstractDeclaration

        static SyntaxNode MakeAbstractDeclaration(MemberDeclarationSyntax abstractDeclaration)
        {
            var method = abstractDeclaration as MethodDeclarationSyntax;

            var modifier = abstractDeclaration.GetModifiers();
            var newModifier = SyntaxFactory.TokenList(modifier.Where(m => !m.IsKind(SyntaxKind.VirtualKeyword) && !m.IsKind(SyntaxKind.StaticKeyword) && !m.IsKind(SyntaxKind.SealedKeyword)).Concat(
                new[] { SyntaxFactory.Token(SyntaxKind.AbstractKeyword) }
            ));

            if (method != null)
            {
                return SyntaxFactory.MethodDeclaration(
                    method.AttributeLists,
                    newModifier,
                    method.ReturnType,
                    method.ExplicitInterfaceSpecifier,
                    method.Identifier,
                    method.TypeParameterList,
                    method.ParameterList,
                    method.ConstraintClauses,
                    null,
                    method.ExpressionBody,
                    SyntaxFactory.Token(SyntaxKind.SemicolonToken));
            }

            var property = abstractDeclaration as PropertyDeclarationSyntax;
            if (property != null)
            {
                var accessors = new List<AccessorDeclarationSyntax>();
                foreach (var accessor in property.AccessorList.Accessors)
                {
                    accessors.Add(SyntaxFactory.AccessorDeclaration(accessor.Kind(), accessor.AttributeLists, accessor.Modifiers, accessor.Keyword, null, SyntaxFactory.Token(SyntaxKind.SemicolonToken)));
                }
                return SyntaxFactory.PropertyDeclaration(
                    property.AttributeLists,
                    newModifier,
                    property.Type,
                    property.ExplicitInterfaceSpecifier,
                    property.Identifier,
                    SyntaxFactory.AccessorList(SyntaxFactory.List<AccessorDeclarationSyntax>(accessors)),
                    property.ExpressionBody,
                    property.Initializer);
            }

            var indexer = abstractDeclaration as IndexerDeclarationSyntax;
            if (indexer != null)
            {
                var accessors = new List<AccessorDeclarationSyntax>();
                foreach (var accessor in indexer.AccessorList.Accessors)
                {
                    accessors.Add(SyntaxFactory.AccessorDeclaration(accessor.Kind(), accessor.AttributeLists, accessor.Modifiers, accessor.Keyword, null, SyntaxFactory.Token(SyntaxKind.SemicolonToken)));
                }
                return SyntaxFactory.IndexerDeclaration(
                    indexer.AttributeLists,
                    newModifier,
                    indexer.Type,
                    indexer.ExplicitInterfaceSpecifier,
                    indexer.ParameterList,
                    SyntaxFactory.AccessorList(SyntaxFactory.List<AccessorDeclarationSyntax>(accessors)),
                    indexer.ExpressionBody);
            }
            var evt = abstractDeclaration as EventDeclarationSyntax;
            if (evt != null)
            {
                return SyntaxFactory.EventFieldDeclaration(
                    evt.AttributeLists,
                    newModifier,
                    SyntaxFactory.VariableDeclaration(
                        evt.Type,
                        SyntaxFactory.SeparatedList<VariableDeclaratorSyntax>(
                            new[] {
                                SyntaxFactory.VariableDeclarator(evt.Identifier)
                            }
                        )
                    )
                );
            }
            var evt2 = abstractDeclaration as EventFieldDeclarationSyntax;
            if (evt2 != null)
            {
                return evt2.WithModifiers(newModifier);
            }
            return null;
        }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:84,代码来源:ToAbstractVirtualNonVirtualConversionCodeRefactoringProvider.cs

示例12: ImplementAbstractDeclaration

        static SyntaxNode ImplementAbstractDeclaration(MemberDeclarationSyntax abstractDeclaration, bool implementAsVirtual = false)
        {
            var method = abstractDeclaration as MethodDeclarationSyntax;

            var modifier = abstractDeclaration.GetModifiers();
            var newMods = modifier.Where(m => !m.IsKind(SyntaxKind.AbstractKeyword) && !m.IsKind(SyntaxKind.StaticKeyword));
            if (implementAsVirtual)
            {
                newMods = newMods.Concat(
                    new[] { SyntaxFactory.Token(SyntaxKind.VirtualKeyword) }
                );
            }

            var newModifier = SyntaxFactory.TokenList(newMods);

            if (method != null)
            {
                return SyntaxFactory.MethodDeclaration(
                    method.AttributeLists,
                    newModifier,
                    method.ReturnType,
                    method.ExplicitInterfaceSpecifier,
                    method.Identifier,
                    method.TypeParameterList,
                    method.ParameterList,
                    method.ConstraintClauses,
                    CreateNotImplementedBody(),
                    method.ExpressionBody);
            }

            var property = abstractDeclaration as PropertyDeclarationSyntax;
            if (property != null)
            {
                var accessors = new List<AccessorDeclarationSyntax>();
                foreach (var accessor in property.AccessorList.Accessors)
                {
                    accessors.Add(SyntaxFactory.AccessorDeclaration(accessor.Kind(), accessor.AttributeLists, accessor.Modifiers, CreateNotImplementedBody()));
                }
                return SyntaxFactory.PropertyDeclaration(
                    property.AttributeLists,
                    newModifier,
                    property.Type,
                    property.ExplicitInterfaceSpecifier,
                    property.Identifier,
                    SyntaxFactory.AccessorList(SyntaxFactory.List<AccessorDeclarationSyntax>(accessors)),
                    property.ExpressionBody,
                    property.Initializer);
            }

            var indexer = abstractDeclaration as IndexerDeclarationSyntax;
            if (indexer != null)
            {
                var accessors = new List<AccessorDeclarationSyntax>();
                foreach (var accessor in indexer.AccessorList.Accessors)
                {
                    accessors.Add(SyntaxFactory.AccessorDeclaration(accessor.Kind(), accessor.AttributeLists, accessor.Modifiers, CreateNotImplementedBody()));
                }
                return SyntaxFactory.IndexerDeclaration(
                    indexer.AttributeLists,
                    newModifier,
                    indexer.Type,
                    indexer.ExplicitInterfaceSpecifier,
                    indexer.ParameterList,
                    SyntaxFactory.AccessorList(SyntaxFactory.List<AccessorDeclarationSyntax>(accessors)),
                    indexer.ExpressionBody);
            }

            var evt = abstractDeclaration as EventDeclarationSyntax;
            if (evt != null)
            {
                var accessors = new List<AccessorDeclarationSyntax>();
                foreach (var accessor in evt.AccessorList.Accessors)
                {
                    accessors.Add(SyntaxFactory.AccessorDeclaration(accessor.Kind(), CreateNotImplementedBody()));
                }
                return SyntaxFactory.EventDeclaration(
                    evt.AttributeLists,
                    newModifier,
                    evt.Type,
                    evt.ExplicitInterfaceSpecifier,
                    evt.Identifier,
                    SyntaxFactory.AccessorList(SyntaxFactory.List<AccessorDeclarationSyntax>(accessors))
                );
            }

            var evtField = abstractDeclaration as EventFieldDeclarationSyntax;
            if (evtField != null)
            {
                return SyntaxFactory.EventFieldDeclaration(
                    evtField.AttributeLists,
                    newModifier,
                    evtField.Declaration
                );
            }

            return null;
        }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:97,代码来源:ToAbstractVirtualNonVirtualConversionCodeRefactoringProvider.cs

示例13: GetAccessLevel

        private static AccessLevel GetAccessLevel(MemberDeclarationSyntax member)
        {
            bool isProtected = false;
            bool isInternal = false;
            foreach (var modifier in member.GetModifiers())
            {
                switch (modifier.Kind())
                {
                case SyntaxKind.PublicKeyword:
                    return AccessLevel.Public;
                case SyntaxKind.PrivateKeyword:
                    return AccessLevel.Private;
                case SyntaxKind.InternalKeyword:
                    if (isProtected)
                    {
                        return AccessLevel.ProtectedInternal;
                    }
                    else
                    {
                        isInternal = true;
                    }

                    break;
                case SyntaxKind.ProtectedKeyword:
                    if (isInternal)
                    {
                        return AccessLevel.ProtectedInternal;
                    }
                    else
                    {
                        isProtected = true;
                    }

                    break;
                }
            }

            if (isProtected)
            {
                return AccessLevel.Protected;
            }
            else if (isInternal)
            {
                return AccessLevel.Internal;
            }

            return AccessLevel.NotSpecified;
        }
开发者ID:shivinsky,项目名称:StyleCopAnalyzers,代码行数:48,代码来源:SA1202ElementsMustBeOrderedByAccess.cs

示例14: IsAltered

        bool IsAltered(SemanticModel model, MemberDeclarationSyntax member, ISymbol symbol, CancellationToken token, out bool wasUsed)
        {
            wasUsed = false;
            foreach (var usage in member.DescendantNodesAndSelf().Where(n => n.IsKind(SyntaxKind.IdentifierName)).OfType<ExpressionSyntax>())
            {
                var info = model.GetSymbolInfo(usage).Symbol;
                if (info == symbol)
                    wasUsed = true;
                if (!usage.IsWrittenTo())
                {
                    // Special case: If variable is of a value type, check if one of its members is altered.
                    var memberAccExpr = usage.Parent as MemberAccessExpressionSyntax;
                    if (symbol.GetReturnType().IsReferenceType
                        || (memberAccExpr == null)
                        || (info != symbol)
                        || (memberAccExpr.Name == usage)
                        || !memberAccExpr.IsWrittenTo())
                        continue;
                }

                if (member.IsKind(SyntaxKind.ConstructorDeclaration) && !usage.Ancestors().Any(a => a.IsKind(SyntaxKind.AnonymousMethodExpression) || a.IsKind(SyntaxKind.SimpleLambdaExpression) || a.IsKind(SyntaxKind.ParenthesizedLambdaExpression)))
                {
                    if (member.GetModifiers().Any(m => m.IsKind(SyntaxKind.StaticKeyword)) == info.IsStatic)
                        continue;
                }
                if (info == symbol)
                    return true;
            }
            return false;
        }
开发者ID:ceddlyburge,项目名称:RefactoringEssentials,代码行数:30,代码来源:FieldCanBeMadeReadOnlyAnalyzer.cs


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