コード例 #1
0
        private IEnumerable <KeyValuePair <string, IList <DeclaredElementInstance <IMethod> > > > GetTaskMethods(ISymbolScope symbolScope)
        {
            var map = new OneToListMap <string, DeclaredElementInstance <IMethod> >();

            foreach (var shortName in symbolScope.GetAllShortNames())
            {
                if (!shortName.EndsWith("Tasks"))
                {
                    continue;
                }
                var symbols = symbolScope.GetElementsByShortName(shortName);

                foreach (var symbol in symbols)
                {
                    if (!(symbol is IClass @class))
                    {
                        continue;
                    }
                    if ([email protected]().QualifiedName.StartsWith("Nuke"))
                    {
                        continue;
                    }

                    foreach (var classMethod in @class.Methods
                             .Where(x => x.AccessibilityDomain.DomainType == AccessibilityDomain.AccessibilityDomainType.PUBLIC && x.IsStatic))
                    {
                        map.Add(classMethod.ShortName, new DeclaredElementInstance <IMethod>(classMethod));
                    }
                }
            }

            return(map);
        }