本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List类的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List类的具体用法?C# System.Collections.Generic.List怎么用?C# System.Collections.Generic.List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Collections.Generic.List类属于System.Collections.Generic命名空间,在下文中一共展示了System.Collections.Generic.List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGroupedRelatedItems
public System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> GetGroupedRelatedItems(AccountItem itemCompareTo, bool searchingOnlyCurrentMonthData = true, System.Action<AccountItem> itemAdded = null)
{
System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> list = new System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel>();
IOrderedEnumerable<AccountItem> source = from p in this.GetRelatedItems(itemCompareTo, searchingOnlyCurrentMonthData)
orderby p.CreateTime descending
select p;
if (itemAdded == null)
{
itemAdded = delegate(AccountItem ai)
{
};
}
var dates = (from p in source select p.CreateTime.Date).Distinct<System.DateTime>();
foreach (var item in dates)
{
GroupByCreateTimeAccountItemViewModel agvm = new GroupByCreateTimeAccountItemViewModel(item);
source.Where(p => p.CreateTime.Date == item.Date).ToList<AccountItem>().ForEach(delegate(AccountItem x)
{
agvm.Add(x);
itemAdded(x);
});
list.Add(agvm);
}
return list;
}
示例2: smart_split_tests
public IEnumerable<StringTest> smart_split_tests()
{
System.Collections.Generic.List<StringTest> result = new System.Collections.Generic.List<StringTest>();
result.Add(new StringTest("smart split-01",
@"This is ""a person\'s"" test.",
new string[] { "This", "is", @"""a person\'s""", "test." }
));
result.Add(new StringTest("smart split-02",
@"Another 'person\'s' test.",
new string[] { "Another", @"'person's'", "test." }
));
result.Add(new StringTest("smart split-03",
"A \"\\\"funky\\\" style\" test.",
new string[] { "A", "\"\"funky\" style\"", "test." }
));
result.Add(new StringTest("smart split-04",
@"A '\'funky\' style' test.",
new string[] { "A", @"''funky' style'", "test." }
));
return result;
}
示例3: SaveChanges
public override ObjectWithId SaveChanges(bool updateTree)
{
DebtActionStatusContent content = new DebtActionStatusContent();
System.Collections.Generic.List<FasetItem> list = (System.Collections.Generic.List<FasetItem>) this.bsAllActionStatusContents.get_DataSource();
System.Collections.Generic.List<FasetItem> list2 = (System.Collections.Generic.List<FasetItem>) this.bsAvailableActionStatusContents.get_DataSource();
System.Collections.Generic.List<FasetItem> list3 = new System.Collections.Generic.List<FasetItem>();
this.fillStatusContent();
foreach (FasetItem item in this.availableStatusContent)
{
foreach (FasetItem item2 in list2)
{
if (item.Id == item2.Id)
{
list3.Add(item);
}
}
}
foreach (FasetItem item3 in this.availableStatusContent)
{
list.Remove(item3);
}
foreach (FasetItem item4 in list)
{
content.DebtActionStatusId = (int) ((int) this.status.Id);
content.StatusId = item4.Id;
content.Created = System.DateTime.Now;
content.Insert();
}
foreach (FasetItem item5 in list3)
{
content.Id = content.FindByDebtActionStatusIdAndDebtActionStatusId((int) ((int) this.status.Id), item5.Id).Id;
content.Delete();
}
return content;
}
示例4: ChromeOptions_add_one_extension
public void ChromeOptions_add_one_extension()
{
string[] expected = { "SePSX.dll" };
AddSeChromeExtensionCommand cmdlet =
//new AddSeChromeExtensionCommandTestFixture();
WebDriverFactory.Container.Resolve<AddSeChromeExtensionCommand>();
//AddSeChromeExtensionCommand.UnitTestMode = true;
cmdlet.InputObject =
//WebDriverFactory.GetChromeOptions();
// resolve ChromeOptions
WebDriverFactory.Container.Resolve<ChromeOptions>();
cmdlet.ExtensionList =
expected;
SeAddChromeExtensionCommand command =
new SeAddChromeExtensionCommand(cmdlet);
command.Execute();
System.Collections.Generic.List<string> listOfArguments =
new System.Collections.Generic.List<string>();
listOfArguments.Add(expected[0]);
ReadOnlyCollection<string> expectedList =
new ReadOnlyCollection<string>(listOfArguments);
//Assert.AreEqual(expectedList, (SePSX.CommonCmdletBase.UnitTestOutput[0] as ChromeOptions).Extensions);
Assert.AreEqual(
expectedList,
((ChromeOptions)(object)PSTestLib.UnitTestOutput.LastOutput[0]).Extensions);
}
示例5: Build
public static void Build(ref GMapOverlay OverlayOut)
{
// Here loop through defined sectors and display them on the map
foreach (SystemAdaptationDataSet.SectorBorder Sector in SystemAdaptationDataSet.SectorBorderDataSet)
{
System.Collections.Generic.List<PointLatLng> SectorPointList = new System.Collections.Generic.List<PointLatLng>();
foreach (GeoCordSystemDegMinSecUtilities.LatLongClass SectorPoint in Sector.SectorBorderPoints)
{
SectorPointList.Add(new PointLatLng(SectorPoint.GetLatLongDecimal().LatitudeDecimal, SectorPoint.GetLatLongDecimal().LongitudeDecimal));
}
// Get sector border display attributes
DisplayAttributes.DisplayAttributesType SectorBorderDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.SectorBorder);
GMapPolygon SectorPolygon = new GMapPolygon(SectorPointList, Sector.SectorName);
SectorPolygon.Stroke = new Pen(SectorBorderDisplayAttribute.LineColor, SectorBorderDisplayAttribute.LineWidth);
Type brushType = typeof(Brushes);
Brush myBrush = (Brush)brushType.InvokeMember(SectorBorderDisplayAttribute.AreaPolygonColor.Name,
BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty,
null, null, new object[] { });
SectorPolygon.Fill = myBrush;
OverlayOut.Polygons.Add(SectorPolygon);
}
}
示例6: Display_ViewAll
protected void Display_ViewAll()
{
CatalogEntry CatalogManager = new CatalogEntry(m_refContentApi.RequestInformationRef);
System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();
entryCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
entryCriteria.PagingInfo.CurrentPage = _currentPageNumber;
entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_iID);
entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.ContentLanguage);
entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
entryCriteria.AddFilter(EntryProperty.IsPublished, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
entryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
entryCriteria.OrderByField = Util_GetSortColumn();
switch (m_sPageAction)
{
case "browsecrosssell":
case "browseupsell":
case "couponselect":
// If m_sPageAction = "couponselect" Then entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, CatalogEntryType.SubscriptionProduct)
entryList = CatalogManager.GetList(entryCriteria);
break;
case "browse":
long[] IdList = new long[3];
IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
// IdList(1) = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct
entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
if (excludeId > 0)
{
entryCriteria.AddFilter(EntryProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, excludeId);
}
entryList = CatalogManager.GetList(entryCriteria);
break;
default:
pnl_catalogs.Visible = true;
pnl_viewall.Visible = false;
System.Collections.Generic.List<CatalogData> catalogList = new System.Collections.Generic.List<CatalogData>();
catalogList = CatalogManager.GetCatalogList(1, 1);
Util_ShowCatalogs(catalogList);
break;
}
TotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);
if (TotalPagesNumber > 1) {
SetPagingUI();
}
Populate_ViewCatalogGrid(entryList);
}
示例7: VsServer
/// <summary>
/// Start the console server.
/// </summary>
/// <param name="args">These are optional arguments.Pass the local ip address of the server as the first argument and the local port as the second argument.</param>
public VsServer()
{
vsClients = new List<ClientManager>();
vsAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0,8));
vsSettingsFile = Path.Combine(vsAppPath, "server.config");
}
示例8: GetAllForProduct_should_return_active_stockItems_for_product
public void GetAllForProduct_should_return_active_stockItems_for_product()
{
Func<int, string, string, StockItem> createStockItem = (id, size, product) =>
StockItem.Create(product, size, new DateTime(2011, 2, 20), "[email protected]").SetId(id);
var stockItems = new System.Collections.Generic.List<StockItem>
{
createStockItem(1, "-", "Widget"),
createStockItem(2, "Error", "Widget"),
createStockItem(3, "s", "Widget"),
createStockItem(4, "m", "Widget"),
createStockItem(5, "l", "Widget"),
createStockItem(6, "-", "Gadget"),
createStockItem(7, "Large", "Gadget"),
};
stockItems[0].Deactivate(new DateTime(2011, 2, 20), "mike");
stockItems[1].Deactivate(new DateTime(2011, 2, 20), "mike");
stockItemRepository.GetAllDelegate = () => stockItems.AsQueryable();
var returnedItems = stockItemService.GetAllForProduct("Widget");
returnedItems.Count().ShouldEqual(3);
returnedItems.First().ShouldBeTheSameAs(stockItems[2]);
returnedItems.Last().ShouldBeTheSameAs(stockItems[4]);
}
示例9: startExit
//Sets the exit of the start tile (selecting a random one inside the bounds).
public int startExit (Coordinate coordinate)
{
int res = 0;
List<int> allExits = new System.Collections.Generic.List<int> ();
for (int i =1; i<7; i++) {
allExits.Add (i);
}
while (res == 0) {
int randomVal = (int)Mathf.Floor (Random.Range (0, allExits.Count));
int possibleExit = allExits [randomVal];
Coordinate possibleFirstTile = getCoordinateFromExit (coordinate, possibleExit);
if (isOnBounds (possibleFirstTile)) {
res = possibleExit;
} else {
allExits.RemoveAt (randomVal);
}
}
return res;
}
示例10: Index
public ActionResult Index()
{
var clients = new System.Collections.Generic.List<Client>
{
new Client { Id = 1, Name = "Julio Avellaneda", Email = "[email protected]" },
new Client { Id = 2, Name = "Juan Torres", Email = "[email protected]" },
new Client { Id = 3, Name = "Oscar Camacho", Email = "[email protected]" },
new Client { Id = 4, Name = "Gina Urrego", Email = "[email protected]" },
new Client { Id = 5, Name = "Nathalia Ramirez", Email = "[email protected]" },
new Client { Id = 6, Name = "Raul Rodriguez", Email = "[email protected]" },
new Client { Id = 7, Name = "Johana Espitia", Email = "johana_espitia[email protected]" },
new Client { Id = 11, Name = "Julio Avellaneda", Email = "[email protected]" },
new Client { Id = 22, Name = "Juan Torres", Email = "[email protected]" },
new Client { Id = 33, Name = "Oscar Camacho", Email = "[email protected]" },
new Client { Id = 42, Name = "Gina Urrego", Email = "[email protected]" },
new Client { Id = 50, Name = "Nathalia Ramirez", Email = "[email protected]" },
new Client { Id = 62121, Name = "Raul Rodriguez", Email = "[email protected]" },
new Client { Id = 721, Name = "Johana Espitia", Email = "[email protected]" },
new Client { Id = 121, Name = "Julio Avellaneda", Email = "[email protected]" },
new Client { Id = 221, Name = "Juan Torres", Email = "[email protected]" },
new Client { Id = 321, Name = "Oscar Camacho", Email = "[email protected]" },
new Client { Id = 421, Name = "Gina Urrego", Email = "[email protected]" },
new Client { Id = 521, Name = "Nathalia Ramirez", Email = "[email protected]" },
new Client { Id = 621, Name = "Raul Rodriguez", Email = "[email protected]" },
new Client { Id = 72, Name = "Johana Espitia", Email = "[email protected]" }
};
return View(clients);
}
示例11: Notify
public void Notify(params object[] args)
{
if (args != null && args.Length != 0 && args[0] is EntityEvent)
{
BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey;
if (!(key == null))
{
Customer customer = key.GetEntity() as Customer;
if (PubHelper.IsOrg_Customer2DMS(customer))
{
bool flag = PubHelper.IsUsedDMSAPI();
if (flag)
{
//if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006"))
// || (customer.CustomerCategory != null
// && customer.CustomerCategory.DescFlexField != null
// && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool()
// )
// )
if(
PubHelper.IsUpdateDMS(customer)
)
{
try
{
SI08ImplService service = new SI08ImplService();
// service.Url = PubHelper.GetAddress(service.Url);
System.Collections.Generic.List<dealerInfoDto> list = new System.Collections.Generic.List<dealerInfoDto>();
dealerInfoDto dto = new dealerInfoDto();
dto.dealerCode = customer.Code;
dto.dealerName = customer.Name;
dto.dealerShortName = customer.ShortName;
dto.companyCode = customer.Code;
dto.companyName = customer.Name;
dto.companyShortName = customer.ShortName;
if (customer.CustomerCategoryKey != null)
{
dto.dealerType = int.Parse(customer.CustomerCategory.Code);
}
dto.actionType = 3;
// status 100201 有效 100202 无效
dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202";
list.Add(dto);
dealerInfoDto d = service.Do(list.ToArray());
if (d != null && d.flag == 0)
{
throw new System.ApplicationException(d.errMsg);
}
}
catch (System.Exception e)
{
throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
}
}
}
}
}
}
}
示例12: RendererUniversal
public RendererUniversal(Sprite sprite)
: base(sprite)
{
verts = new System.Collections.Generic.List<float>();
colors = new System.Collections.Generic.List<float>();
uvs = new System.Collections.Generic.List<float>();
}
示例13: SearchStaffNode
public System.Collections.Generic.List<SearchNodeStaff> SearchStaffNode(string value)
{
System.Collections.Generic.List<SearchNodeStaff> result;
try
{
if (!string.IsNullOrEmpty(value))
{
System.Collections.Generic.List<Staff> staffList = this.IndexOfStaff(value);
System.Collections.Generic.List<SearchNodeStaff> nodes = null;
if (staffList != null && staffList.Count > 0)
{
nodes = new System.Collections.Generic.List<SearchNodeStaff>();
foreach (Staff staff in staffList)
{
SearchNodeStaff node = new SearchNodeStaff(staff);
if (node != null)
{
nodes.Add(node);
}
}
}
result = nodes;
return result;
}
}
catch (System.Exception e)
{
this.logger.Error(e.ToString());
}
result = null;
return result;
}
示例14: ListFileDlg
public ListFileDlg(EnvDTE80.DTE2 dte,RecordHandler rec)
{
InitializeComponent();
//�����ļ���ַ
txt_FilePath.Text = RecordHandler.GetValueFromRegistry();
_manuallySettingSelection = false;
_dte = dte;
_fileNames = new System.Collections.Generic.List<ProjectItemInfo>();
foreach (EnvDTE.Project project in _dte.Solution.Projects)
{
WalkProject(project.ProjectItems);
}
LogTimer.Interval = 2000;
LogTimer.Tick += new EventHandler(LogTimer_Tick);
RecordTable = initRecordTable();
initProjectSelector();
btn_ReadRecordCurProject_Click(null, null);
de_begin.DateTime = DateTime.Today;
de_end.DateTime = DateTime.Today;
recHandler = rec;
}
示例15: TestAlbersProjection
public void TestAlbersProjection()
{
CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot);
IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null);
IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum,
PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
new AxisInfo("Lat", AxisOrientationEnum.North));
System.Collections.Generic.List<ProjectionParameter> parameters = new System.Collections.Generic.List<ProjectionParameter>(5);
parameters.Add(new ProjectionParameter("central_meridian", -96));
parameters.Add(new ProjectionParameter("latitude_of_center", 23));
parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5));
parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5));
parameters.Add(new ProjectionParameter("false_easting", 0));
parameters.Add(new ProjectionParameter("false_northing", 0));
IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys);
double[] pGeo = new double[] { -75, 35 };
double[] pUtm = trans.MathTransform.Transform(pGeo);
double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);
double[] expected = new double[] { 1885472.7, 1535925 };
Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), String.Format("Albers forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
}