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


C# List.AsEnumerable方法代码示例

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


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

示例1: PerformUpdate

        IEnumerator PerformUpdate()
        {
            while (true)
            {
                for (var i = 0; i < _agents.Count; i++)
                {
                    for (var j = 0; j < _agents.Count; j++)
                    {
                        if (i == j) continue;

                        if (Vector3.Distance(_agents[i].transform.position, _agents[j].transform.position) > SenseDistance) continue;

                        var sense = new Sight { AgentSensed = _agents[j] };

                        _nodeGraph = sense.PropagateSense(PathFinder, _agents[i].transform.position, _agents[j].transform.position);

                        var attenuation = _nodeGraph.AsEnumerable().Sum(node => node.Attenuation);

                        if (attenuation > MaxAttenuation) continue;

                        _agents[i].HandleSense(sense);

                    }
                }

                yield return new WaitForSeconds(.5f);

            }
        }
开发者ID:vladdie,项目名称:Autonomous-Agents,代码行数:29,代码来源:SenseManager.cs

示例2: GetAllConditionCheckers

 protected override IEnumerable<IRefactoringConditionChecker> GetAllConditionCheckers()
 {
     var checkers = new List<IRefactoringConditionChecker>();
     checkers.Add(new ParametersChecker());
     checkers.Add(new ReturnTypeChecker());
     return checkers.AsEnumerable();
 }
开发者ID:nkcsgexi,项目名称:ghostfactor1,代码行数:7,代码来源:ExtractMethodConditionChecker.cs

示例3: PagingGetSearchOption

        public static PagingSearchOption PagingGetSearchOption()
        {
            var request = HttpContext.Current.Request;

            var ret = new PagingSearchOption()
            {
                CurrentPageNo = int.Parse((request[Paging.KEY_CURRENT_PAGE_NO] ?? "1")),
                RowCountOnPage = int.Parse((request[Paging.KEY_ROWCOUNT_ON_PAGE] ?? Paging.CONST_ROWCOUNT_ON_PAGE.ToString())),
                TotalRowCount = int.Parse(request[Paging.KEY_TOTAL_ROW_COUNT] ?? "1")
            };

            var searchOption = (request[Paging.KEY_SEARCH_OPTION] ?? "");

            List<KeyValuePair<string, string>> optionList = new List<KeyValuePair<string,string>>();
            foreach(var option in searchOption.Split(';'))
            {
                if ( option.Contains('=') == false ) continue;
                var optionItem = option.Split('=');

                optionList.Add(new KeyValuePair<string,string>(optionItem[0], optionItem[1]));
            }

            ret.SearchOption = optionList.AsEnumerable();

            return ret;
        }
开发者ID:powerumc,项目名称:UmcCore,代码行数:26,代码来源:PagingSearchOption.cs

示例4: GetMyModules

 public static IEnumerable<module> GetMyModules()
 {
     DBFactory db;
     SqlDataReader rdr;
     List<module> data = null;
                 
     try
     {
         db = new DBFactory("CCATDBEntities");
         rdr = db.ExecuteReader("MSI_GetLeftSideMenu", new SqlParameter("@roleName", GetRoleName()));
         data = new List<module>();
         module record;
         while (rdr.Read())
         {
             record = new module();
             record.moduleId = Convert.ToInt32(rdr["moduleId"].ToString());
             record.pageMenuGroups = rdr["pageMenuGroups"].ToString();
             data.Add(record);
         }
         //Close the datareader
         rdr.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Exception in DataQueries.GetMyModules:" + ex.Message);
     }
     return data.AsEnumerable<module>();
     
 }
开发者ID:jigshGitHub,项目名称:MSI.CCAT.VS2012,代码行数:29,代码来源:moduleController.cs

示例5: Menu

        /// <summary>
        /// Menus the specified date range.
        /// </summary>
        /// <param name="dateRange">The date range.</param>
        /// <returns>Archive widget</returns>
        public PartialViewResult Menu(string dateRange = null)
        {
            ViewBag.SelectedArchive = dateRange;

            IEnumerable<DateTime> dates = this.repository.Articles
                                            .Select(b => b.Modified)
                                            .Distinct()
                                            .OrderByDescending(b => b);

            List<string> dateRanges = new List<string>();

            foreach(DateTime date in dates)
            {
                StringBuilder archiveName = new StringBuilder();

                archiveName.Append(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Month));
                archiveName.Append(" ");
                archiveName.Append(date.Year.ToString());

                if (!dateRanges.Exists(d => d == archiveName.ToString()))
                {
                    dateRanges.Add(archiveName.ToString());
                }
            }

            return PartialView(dateRanges.AsEnumerable());
        }
开发者ID:W1R3D-Code,项目名称:TheExordium,代码行数:32,代码来源:ArchiveController.cs

示例6: ReadDataFromNodes

        private IEnumerable<CodeCoverageStatistics> ReadDataFromNodes(XmlDocument doc, string summaryXmlLocation)
        {
            var listCoverageStats = new List<CodeCoverageStatistics>();

            if (doc == null)
            {
                return null;
            }

            XmlNode reportNode = doc.SelectSingleNode("coverage");

            if (reportNode != null)
            {
                if (reportNode.Attributes != null)
                {
                    CodeCoverageStatistics coverageStatisticsForLines = GetCCStats(labelTag: _linesCovered, coveredTag: _linesCoveredTag, validTag: _linesValidTag,
                                                                                    priorityTag: "line", summaryXmlLocation: summaryXmlLocation, reportNode: reportNode);

                    if (coverageStatisticsForLines != null)
                    {
                        listCoverageStats.Add(coverageStatisticsForLines);
                    }

                    CodeCoverageStatistics coverageStatisticsForBranches = GetCCStats(labelTag: _branchesCovered, coveredTag: _branchesCoveredTag, validTag: _branchesValidTag,
                                                                                        priorityTag: "branch", summaryXmlLocation: summaryXmlLocation, reportNode: reportNode);

                    if (coverageStatisticsForBranches != null)
                    {
                        listCoverageStats.Add(coverageStatisticsForBranches);
                    }
                }
            }

            return listCoverageStats.AsEnumerable();
        }
开发者ID:codedebug,项目名称:vsts-agent,代码行数:35,代码来源:CoberturaSummaryReader.cs

示例7: GetLineProperty

        public IEnumerable<LineProperty> GetLineProperty(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<LineProperty> LinePropertyList = new List<LineProperty>();
            try
            {
                DataTable resultTable = axHelper.GetLinePropertyList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    LineProperty LinePropertyObject = new LineProperty();
                    LinePropertyObject.LinePropertyCode = row["LinePropertyCode"].ToString();
                    LinePropertyObject.LinePropertyDescription =  row["LinePropertyName"].ToString();

                    LinePropertyList.Add(LinePropertyObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return LinePropertyList.AsEnumerable<LineProperty>();
        }
开发者ID:smarutharaj,项目名称:CoincoDevMVC4,代码行数:25,代码来源:LineProperty.cs

示例8: GetDataDemo

 public List<CampaignConflitView> GetDataDemo()
 {
     string s = "אבגדaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgG";
     char[] ch = s.ToCharArray();
     var data = new List<CampaignConflitView>();
     ;
     int i = 0;
     while (i < 28)
     {
         data.Add(new CampaignConflitView
         {
             TypeCode = i.ToString(),
             CampaignId = Guid.NewGuid(),
             CampaignName = ch[i].ToString(),
             CampaignSubtypeId = Guid.NewGuid(),
             CampaignApprovalStatus = true.ToString(),
             ProposedStartDate = DateTime.Now.AddDays(i),
             ProposedEndDate = DateTime.Now.AddDays(i),
             ConflitContacts = i,
             ListId = Guid.NewGuid(),
             ListName = ch[i].ToString(),
             CampaignSubtypeName = "dd"
         });
         i++;
     }
     return data.AsEnumerable().OrderBy(r => r.CampaignName).ToList();
 }
开发者ID:zoluo,项目名称:CampaignsReport,代码行数:27,代码来源:ServiceCampaign.cs

示例9: Swummarize

        public static IEnumerable<Tuple<string, string>> Swummarize(string directoryPath)
        {
            var swummaries = new List<Tuple<string, string>>();

            var srcmlMethods = MethodExtractor.ExtractAllMethodsFromDirectory(directoryPath);

            foreach (var methodDef in srcmlMethods)
            {
                // Extract SUnit Statements from MethodDefinition
                var statements = SUnitExtractor.ExtractAll(methodDef).ToList();

                // Translate Statements into SUnits
                List<SUnit> sunits = statements.ConvertAll(
                            new Converter<Statement, SUnit>(SUnitTranslator.Translate));

                // Generate text from SUnits
                List<string> sentences = sunits.ConvertAll(
                            new Converter<SUnit, string>(TextGenerator.GenerateText));

                // Collect text and summarize
                var methodDocument = String.Join<string>("\n", sentences);

                // TEMP: Just use full set of sentences for now. Don't use Summarizer.
                //       Maybe set a flag for this.
                //var summary = Summarizer.Summarize(methodDocument);
                var summary = methodDocument;

                // Add swummary to collection with its full method name
                var methodName = methodDef.GetFullName();
                swummaries.Add(new Tuple<string, string>(methodName, summary));
            }

            return swummaries.AsEnumerable();
        }
开发者ID:herbertkb,项目名称:Swummary,代码行数:34,代码来源:Swummary.cs

示例10: GetLocationsAndBusiness

        public static Task<IEnumerable<LocationDescription>> GetLocationsAndBusiness(string query, GeoCoordinate currentUserPosition)
        {
            var locations = new List<LocationDescription>();

            return GetBingLocations(query, currentUserPosition).ContinueWith(
                bingContinuation =>
                {
                    return GetGooglePlaces(query, currentUserPosition).ContinueWith(
                        googleContinuation =>
                        {
                            if (bingContinuation.IsCompleted)
                            {
                                locations.AddRange(bingContinuation.Result);
                            }

                            if (googleContinuation.IsCompleted)
                            {
                                locations.AddRange(googleContinuation.Result);
                            }

                            locations = SortLocationDescriptionsByDistance(locations, currentUserPosition);

                            return locations.AsEnumerable();
                        });
                }).Unwrap();
        }
开发者ID:kyvok,项目名称:TransitWP7,代码行数:26,代码来源:ProxyQuery.cs

示例11: GetItemNumbers

        public IEnumerable<PartDetails> GetItemNumbers(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<PartDetails> itemnumberList = new List<PartDetails>();
            try
            {
                DataTable resultTable = axHelper.GetItemNumbersList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    PartDetails partObject = new PartDetails();
                    partObject.ItemNumber = row["ItemNumber"].ToString();
                    partObject.ProductName = row["ProductName"].ToString();
                    partObject.ProductSubType = row["ProductSubType"].ToString();
                    itemnumberList.Add(partObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return itemnumberList.AsEnumerable<PartDetails>();
        }
开发者ID:smarutharaj,项目名称:CoincoDevMVC4,代码行数:25,代码来源:PartDetails.cs

示例12: ParseBISolutionFile

 public static IEnumerable<FileInfo> ParseBISolutionFile(this FileInfo source)
 {
     var biFiles = new List<FileInfo>();
     biFiles.AddRange(source.GetSSISPackages());
     biFiles.AddRange(source.GetSqlScripts());
     return biFiles.AsEnumerable();
 }
开发者ID:kmoormann,项目名称:MicrosoftBusinessIntelligenceDeploymentWizard,代码行数:7,代码来源:DeploymentExtensionMethods.cs

示例13: Execute

        public override IEnumerable<Row> Execute(IEnumerable<Row> rows)
        {
            //Console.WriteLine("Truncating Table");
            //TruncateTable(this.TargetTable, this.ConnectionStringSettings.ConnectionString);
            Console.WriteLine("Current feed data processing started");
            var rowsToBeInserted = new List<Row>();
            foreach (var row in rows)
            {
                var array = row["AWord"].ToString().Split(',');
                var i = 1;
                row["Name"] = array[i++];
                row["Description"] = array[i++];
                row["ImagePath"] = array[i++];
                row["PromotionId"] = array[i++];
                row["RAM"] = array[i++];
                row["Harddisk"] = array[i++];
                row["Processor"] = array[i++];
                row["Display"] = array[i++];
                rowsToBeInserted.Add(row);
            }
            //Bulk insert data
            var results = base.Execute(rowsToBeInserted.AsEnumerable());

            //Display all the rows to be inserted
            DisplayRows(rowsToBeInserted);

            Console.WriteLine("Feeds are processed");
            return results;
        }
开发者ID:Thejraj,项目名称:RhinoETL,代码行数:29,代码来源:BaseBulkInsertData.cs

示例14: TryGiveTerminalJob

 protected override Job TryGiveTerminalJob(Pawn pawn)
 {
     if (!(pawn is Droid))
     {
         return null;
     }
     Droid droid = (Droid)pawn;
     if (!droid.Active)
         return null;
     //Check the charge level
     if (droid.TotalCharge < droid.MaxEnergy * chargeThreshold)
     {
         IEnumerable<Thing> chargers;
         List<Thing> list = new List<Thing>();
         foreach(var c in Find.ListerBuildings.AllBuildingsColonistOfClass<Building_DroidChargePad>())
         {
             list.Add((Thing)c);
         }
         chargers = list.AsEnumerable();
         Predicate<Thing> pred = (Thing thing) => { return ((Building_DroidChargePad)thing).IsAvailable(droid); };
         Thing target = GenClosest.ClosestThing_Global_Reachable(pawn.Position, chargers, PathEndMode.OnCell, TraverseParms.For(pawn), distance, pred);
         if (target != null)
         {
             return new Job(DefDatabase<JobDef>.GetNamed("MD2ChargeDroid"), new TargetInfo(target));
         }
     }
     return null;
 }
开发者ID:Leucetius,项目名称:MD2-Source,代码行数:28,代码来源:JobGiver_DroidCharge.cs

示例15: GetFailureCode

        public IEnumerable<FailureCode> GetFailureCode(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<FailureCode> failureCodeList = new List<FailureCode>();
            try
            {
                DataTable resultTable = axHelper.GetFailureCodeList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    FailureCode failureCodeObject = new FailureCode();
                    failureCodeObject.FailureCodeNo = row["FailureCode"].ToString();
                    failureCodeObject.FailureDescription = row["FailureCode"].ToString() + " - " + row["FailureDescription"].ToString();

                    failureCodeList.Add(failureCodeObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return failureCodeList.AsEnumerable<FailureCode>();
        }
开发者ID:smarutharaj,项目名称:CoincoDevMVC4,代码行数:25,代码来源:FailureCode.cs


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