Example #1
0
        public static bool TryCreate(MemberDeclarationSyntax containingMember, SyntaxList <MemberDeclarationSyntax> members, TextSpan span, out MemberDeclarationSelection selectedMembers)
        {
            if (members.Any())
            {
                IndexPair indexes = GetIndexes(members, span);

                if (indexes.StartIndex != -1)
                {
                    selectedMembers = new MemberDeclarationSelection(containingMember, members, span, indexes.StartIndex, indexes.EndIndex);
                    return(true);
                }
            }

            selectedMembers = null;
            return(false);
        }
        private static bool TryCreate(MemberDeclarationSyntax containingMember, SyntaxList <MemberDeclarationSyntax> members, TextSpan span, out MemberDeclarationSelection selection)
        {
            selection = null;

            if (!members.Any())
            {
                return(false);
            }

            (int startIndex, int endIndex) = GetIndexes(members, span);

            if (startIndex == -1)
            {
                return(false);
            }

            selection = new MemberDeclarationSelection(containingMember, members, span, startIndex, endIndex);
            return(true);
        }
Example #3
0
 public static bool TryCreate(StructDeclarationSyntax structDeclaration, TextSpan span, out MemberDeclarationSelection selectedMembers)
 {
     if (structDeclaration != null)
     {
         return(TryCreate(structDeclaration, structDeclaration.Members, span, out selectedMembers));
     }
     else
     {
         selectedMembers = null;
         return(false);
     }
 }
Example #4
0
 public static bool TryCreate(NamespaceDeclarationSyntax namespaceDeclaration, TextSpan span, out MemberDeclarationSelection selectedMembers)
 {
     if (namespaceDeclaration != null)
     {
         return(TryCreate(namespaceDeclaration, namespaceDeclaration.Members, span, out selectedMembers));
     }
     else
     {
         selectedMembers = null;
         return(false);
     }
 }