本文整理汇总了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);
}
}
示例2: GetAllConditionCheckers
protected override IEnumerable<IRefactoringConditionChecker> GetAllConditionCheckers()
{
var checkers = new List<IRefactoringConditionChecker>();
checkers.Add(new ParametersChecker());
checkers.Add(new ReturnTypeChecker());
return checkers.AsEnumerable();
}
示例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;
}
示例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>();
}
示例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());
}
示例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();
}
示例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>();
}
示例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();
}
示例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();
}
示例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();
}
示例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>();
}
示例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;
}
示例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;
}
示例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>();
}