private static IEnumerable <ISymbol> GetAllSymbolsWorker(SymbolKeyResolution resolution) { if (resolution.Symbol != null) { yield return(resolution.Symbol); } foreach (var symbol in resolution.CandidateSymbols) { yield return(symbol); } }
private static IEnumerable <ISymbol> GetAllSymbols(SymbolKeyResolution info) { if (info.Symbol != null) { yield return(info.Symbol); } else { foreach (var symbol in info.CandidateSymbols) { yield return(symbol); } } }
internal static ISymbol GetAnySymbol(this SymbolKeyResolution resolution) { if (resolution.Symbol != null) { return(resolution.Symbol); } if (resolution.CandidateSymbols.Length > 0) { return(resolution.CandidateSymbols[0]); } return(null); }
private static TSymbol GetFirstSymbol <TSymbol>(SymbolKeyResolution resolution) where TSymbol : ISymbol { return(resolution.GetAllSymbols().OfType <TSymbol>().FirstOrDefault()); }
private static IEnumerable <TType> GetAllSymbols <TType>(SymbolKeyResolution info) => GetAllSymbols(info).OfType <TType>();
internal static IEnumerable <ISymbol> GetAllSymbols(this SymbolKeyResolution resolution) { return(GetAllSymbolsWorker(resolution).Distinct()); }