public DeclaredVariables(string source, List <string> namespaceList, bool visibleScopesOnly, DeclarationContext declarationContext) { _declaredVariables = new List <Variable>(); _declarationContext = declarationContext; source = CSharpFormattingTools. RemoveNamespaceDeclarations(source); if (visibleScopesOnly) { source = CSharpFormattingTools. RemoveInaccessibleScopes(source); } FindVariableDeclaratons(source); foreach (Variable v in _declaredVariables) { /* * To allow for nested types we need to replace any '.' * that's not part of a namespace with '+'. */ if (v.Type.IndexOf('.') != -1) { int pos = 0; /* * Need to replace all '.' occurring * after the longest possible namespace * match. */ foreach (string ns in namespaceList) { if (v.Type.StartsWith(ns) && pos <= ns.Length) { pos = ns.Length + 1; } } v.Type = v.Type.Substring(0, pos) + v.Type.Substring(pos).Replace(".", "+"); } } }