本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.Add方法的具体用法?C# System.Collections.Generic.List.Add怎么用?C# System.Collections.Generic.List.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSearchableElements
/// <summary>
/// Gets searchable elements as specified by search source enumeration.
/// </summary>
/// <param name="store">Store.</param>
/// <param name="source">Search source.</param>
/// <returns>List of searchable elements.</returns>
public virtual List<ModelElement> GetSearchableElements(DomainModelStore store, SearchSourceEnum source)
{
System.Collections.Generic.List<ModelElement> elements = new System.Collections.Generic.List<ModelElement>();
if( source == SearchSourceEnum.Elements || source == SearchSourceEnum.ElementsAndReferenceRelationships )
{
foreach (DomainModelElement modelElement in store.ElementDirectory.FindElements<DomainModelElement>())
{
if (IsElementIncludedInDomainTree(store, modelElement.GetDomainClassId()))
elements.Add(modelElement);
}
}
if (source == SearchSourceEnum.ReferenceRelationships || source == SearchSourceEnum.ElementsAndReferenceRelationships)
{
foreach (DomainModelLink modelElement in store.ElementDirectory.FindElements<DomainModelLink>())
{
if (modelElement.IsEmbedding)
continue;
DomainClassInfo info = modelElement.GetDomainClass();
if (IsLinkIncludedInDomainTree(store, info.Id))
elements.Add(modelElement);
}
}
return elements;
}
示例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: split_token_tests
public IEnumerable<StringTest> split_token_tests()
{
System.Collections.Generic.List<StringTest> result = new System.Collections.Generic.List<StringTest>();
result.Add(new StringTest("split token-01",
@"This is _(""a person\'s"") test.",
new string[] { "This", "is", @"_(""a person\'s"")", "test." }
));
result.Add(new StringTest("split token-02",
@"Another 'person\'s' test.",
new string[] { "Another", @"'person's'", "test." }
));
result.Add(new StringTest("split token-03",
"A \"\\\"funky\\\" style\" test.",
new string[] { "A", "\"\"funky\" style\"", "test." }
));
/*
result.Add(new StringTest("split token-04",
"This is _(\"a person's\" test).",
new string[] { "This", "is", "\"a person's\" test)." }
));
// */
return result;
}
示例4: TestMercator_1SP_Projection
public void TestMercator_1SP_Projection()
{
CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre);
IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null);
IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", 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("latitude_of_origin", 0));
parameters.Add(new ProjectionParameter("central_meridian", 110));
parameters.Add(new ProjectionParameter("scale_factor", 0.997));
parameters.Add(new ProjectionParameter("false_easting", 3900000));
parameters.Add(new ProjectionParameter("false_northing", 900000));
IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", 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[] { 120, -3 };
double[] pUtm = trans.MathTransform.Transform(pGeo);
double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);
double[] expected = new double[] { 5009726.58, 569150.82 };
Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
}
示例5: GetDataFeed
public System.Collections.Generic.List<DataFeed> GetDataFeed(PricingLibrary.FinancialProducts.IOption option, System.DateTime fromDate)
{
System.Collections.Generic.List<DataFeed> result = new System.Collections.Generic.List<DataFeed>() ;
using (DataBaseDataContext mtdc = new DataBaseDataContext())
{
var result1 = (from s in mtdc.HistoricalShareValues where ((option.UnderlyingShareIds.Contains(s.id)) && (s.date >= fromDate)&&(s.date<=option.Maturity)) select s).OrderByDescending(d => d.date).ToList();
System.DateTime curentdate = result1[result1.Count() - 1].date;
System.Collections.Generic.Dictionary<String, decimal> priceList = new System.Collections.Generic.Dictionary<String, decimal>();
for (int i = result1.Count() - 1; i >= 0 ; i--)
{
if (result1[i].date==curentdate)
{
priceList.Add(result1[i].id.Trim(), result1[i].value);
}
else
{
DataFeed datafeed = new DataFeed(curentdate, priceList);
result.Add(datafeed);
curentdate = result1[i].date;
priceList = new System.Collections.Generic.Dictionary<String, decimal>();
priceList.Add(result1[i].id.Trim(), result1[i].value);
}
if (i == 0)
{
DataFeed datafeedOut = new DataFeed(curentdate, priceList);
result.Add(datafeedOut);
}
}
return result;
}
}
示例6: Generate3dObject
private void Generate3dObject()
{
double[] frontLeftBottom = new double[] {0,0,0 };
double[] frontRightBottom = new double[] {1,0,0 };
double[] frontLeftTop = new double[] {0,0,1 };
double[] frontRightTop = new double[] { 1,0,1};
double[] backLeftBottom = new double[] { 0,1,0};
double[] backRightBottom = new double[] { 1,1,0};
double[] backLeftTop = new double[] {0,1,1 };
double[] backRightTop = new double[] { 1,1,1};
System.Collections.Generic.List<line> ls = new System.Collections.Generic.List<line>();
ls.Add(new line(frontLeftBottom, frontRightBottom));
ls.Add(new line(frontLeftBottom, frontLeftTop));
ls.Add(new line(frontLeftTop, frontRightTop));
ls.Add(new line(frontRightBottom, frontRightTop));
double[] cameraPosition = new double[] { 0.5, -1, 0.5 };
double cameraRotation = 0.0;
double[][] cameraMatrixx = MatrixExtensions.UnityMatrix(3);
double[] point = frontLeftBottom;
double[] vec = MatrixExtensions.VectorSubtract(point, cameraPosition);
double[] newPoint = MatrixExtensions.MatrixProduct(cameraMatrixx, vec);
bmp = new System.Drawing.Bitmap(100, 100);
using (System.Drawing.Graphics gfx = System.Drawing.Graphics.FromImage(bmp))
{
gfx.DrawRectangle(System.Drawing.Pens.Red, 10, 10, 50, 50);
}
this.pictureBox1.Image = bmp;
}
示例7: CreateCallHistoryDetailsTable
public void CreateCallHistoryDetailsTable()
{
if (CheckTableExists(TABLE_CALL_HISTORY_DETAILS))
{
Console.WriteLine(TABLE_CALL_HISTORY_DETAILS + " table already exists");
return;
}
try
{
List<AttributeDefinition> lstAttribDefinitions = new System.Collections.Generic.List<AttributeDefinition>();
List<KeySchemaElement> lstSchemaElements = new List<KeySchemaElement>();
ProvisionedThroughput throughput = new ProvisionedThroughput() { ReadCapacityUnits = 10, WriteCapacityUnits = 5 };
lstAttribDefinitions.Add(new AttributeDefinition { AttributeName = "CallHistoryDetailsId", AttributeType = ScalarAttributeType.N });
lstAttribDefinitions.Add(new AttributeDefinition { AttributeName = "UCID", AttributeType = ScalarAttributeType.N });
lstSchemaElements.Add(new KeySchemaElement() { AttributeName = "UCID", KeyType = "HASH" });
lstSchemaElements.Add(new KeySchemaElement() { AttributeName = "CallHistoryDetailsId", KeyType = "RANGE" });
CreateTableRequest tbRequest = new CreateTableRequest(TABLE_CALL_HISTORY_DETAILS, lstSchemaElements, lstAttribDefinitions, throughput);
var response = _client.CreateTable(tbRequest);
WaitUntilTableReady(TABLE_CALL_HISTORY);
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
示例8: QualifyTest_ShouldReturnListOfClassifyResult_thatNotContainResultWithPropabilityUnderLimit
public void QualifyTest_ShouldReturnListOfClassifyResult_thatNotContainResultWithPropabilityUnderLimit()
{
List<ClassifyResult> inputList = new System.Collections.Generic.List<ClassifyResult>();
ClassifyResult result1 = new ClassifyResult()
{
Propability = 0.51,
Result = "Italian"
};
ClassifyResult result2 = new ClassifyResult()
{
Propability = 0.04,
Result = "cafe"
};
ClassifyResult result3 = new ClassifyResult()
{
Propability = 1,
Result = "falafel"
};
inputList.Add(result1);
inputList.Add(result2);
inputList.Add(result3);
//Act
var qualityClass = new ClassificationQualityFilter(inputList);
var qualifiedList = qualityClass.Qualify();
//Assert
Assert.IsNotNull(qualifiedList);
Assert.IsFalse(qualifiedList.Any(r => r.Propability <= 0.5));
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Microsoft.Reporting.WebForms.ReportViewer rview = new Microsoft.Reporting.WebForms.ReportViewer();
rview.ServerReport.ReportServerUrl = new Uri(WebConfigurationManager.AppSettings["ReportServer"]);
System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter> paramList = new System.Collections.Generic.List<ReportParameter>();
paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter("Param1", "Value1"));
paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter("Param2", "Value2"));
rview.ServerReport.ReportPath = "/FlamingoSSRSReports/CustomerwiseInquiryReport";
rview.ServerReport.SetParameters(paramList);
string mimeType, encoding, extension, deviceInfo;
string[] streamids;
Microsoft.Reporting.WebForms.Warning[] warnings;
string format = "Excel";
deviceInfo = "<DeviceInfo>" + "<Head1>True</Head1>" + "</DeviceInfo>";
byte[] bytes = rview.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
Response.Clear();
Response.ContentType = "application/excel";
Response.AddHeader("Content-disposition", "filename=output.xls");
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.Flush();
Response.Close();
}
示例10: showHints
public System.Collections.Generic.List<string> showHints(string prefixText)
{
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
list.Add("a");
list.Add("aaa");
list.Add("aaaa");
return list;
}
示例11: Execute
public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
{
string str = "";
for (int i = 0; i < ChatArguments.Length; i++)
{
str = str + ChatArguments[i] + " ";
}
str = str.Trim();
if ((ChatArguments == null) && !(str == ""))
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Kick Usage: /kick \"playerName\"");
}
else if (str != "")
{
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
list.Add("Cancel");
foreach (PlayerClient client in PlayerClient.All)
{
if (client.netUser.displayName.ToLower().Contains(str.ToLower()))
{
if (client.netUser.displayName.ToLower() == str.ToLower())
{
if (Arguments.argUser.userID == client.userID)
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You can't kick yourself.");
}
else if (Administrator.IsAdmin(client.userID) && !Administrator.GetAdmin(Arguments.argUser.userID).HasPermission("RCON"))
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You cannot kick an administrator!");
}
else
{
Core.kickWaitList.Remove(Arguments.argUser.userID);
Administrator.NotifyAdmins(client.netUser.displayName + " has been kicked.");
client.netUser.Kick(NetError.Facepunch_Kick_Violation, true);
}
return;
}
list.Add(client.netUser.displayName);
}
}
if (list.Count != 1)
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, ((list.Count - 1)).ToString() + " Player" + (((list.Count - 1) > 1) ? "s" : "") + " were found: ");
for (int j = 1; j < list.Count; j++)
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, j + " - " + list[j]);
}
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel");
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player you were looking for.");
Core.kickWaitList.Add(Arguments.argUser.userID, list);
}
else
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
}
}
}
示例12: Execute
public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
{
if (ChatArguments == null)
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Teleport Usage: /tpto \"playerName\"");
}
else
{
string str = "";
for (int i = 0; i < ChatArguments.Length; i++)
{
str = str + ChatArguments[i] + " ";
}
str = str.Trim();
if (!(str != ""))
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Teleport Usage: /tphere \"playerName\"");
}
else
{
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
list.Add("ToTarget");
foreach (PlayerClient client in PlayerClient.All)
{
if (client.netUser.displayName.ToLower().Contains(str.ToLower()))
{
if (client.netUser.displayName.ToLower() == str.ToLower())
{
Arguments.Args = new string[] { Arguments.argUser.displayName, client.netUser.displayName };
teleport.toplayer(ref Arguments);
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have teleported to " + client.netUser.displayName);
return;
}
list.Add(client.netUser.displayName);
}
}
if (list.Count != 0)
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, ((list.Count - 1)).ToString() + " Player" + (((list.Count - 1) > 1) ? "s" : "") + " were found: ");
for (int j = 1; j < list.Count; j++)
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, j + " - " + list[j]);
}
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel");
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player you were looking for.");
tpWaitList.Add(Arguments.argUser.userID, list);
}
else
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
}
}
}
}
示例13: ComicImageSource
public ComicImageSource(Comicstyle style)
{
comicstyle = style;
imageExtensions = new System.Collections.Generic.List<string>();
imageExtensions.Add(".JPG");
imageExtensions.Add(".BMP");
imageExtensions.Add(".GIF");
imageExtensions.Add(".PNG");
comicExtensions = new System.Collections.Generic.List<string>();
comicExtensions.Add(".CBR");
comicExtensions.Add(".CBZ");
}
示例14: PopupBonusScene
public PopupBonusScene()
: base()
{
this.dismissed = true;
this.quiz = false;
gameObjects = new System.Collections.Generic.List<GameObject>();
this.cursorRectangle = new Rectangle(
(int)cursor.mouse.X,
(int)cursor.mouse.Y,
1,
1
);
gameObjects.Add(new CursorGameObject(cursor));
this.sceneIndex = SceneIndex.PopupScoreScene;
this.background = new GameObject("menu/menu", new Vector2(Game1.CAMERA_WIDTH / 2, Game1.CAMERA_HEIGHT / 2));
this.background.zindex = 0.8f;
gameObjects.Add(this.background);
this.bonusText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 145), "Yippy Ay Kay Yay!");
this.resumeButton = new MenuItem(new Vector2(Game1.CAMERA_WIDTH / 2, 345), "Resume");
this.bonusWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 185), "Bonus Word: ...");
this.partOfSpeechText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 225), "Part of Speech: ...");
this.similarToText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 265), "Similar to: ...");
this.definitionText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 305), "Definition: ...");
this.bonusText.zindex = .9f;
this.resumeButton.zindex = .9f;
this.bonusWordText.zindex = .9f;
this.partOfSpeechText.zindex = .9f;
this.similarToText.zindex = .9f;
this.definitionText.zindex = .9f;
this.bonusText.fontPath = "fonts/Western";
this.bonusText.fontColor = Color.Green;
this.resumeButton.fontPath = "fonts/Western";
this.bonusWordText.fontPath = "fonts/WesternSmall";
this.partOfSpeechText.fontPath = "fonts/WesternSmall";
this.similarToText.fontPath = "fonts/WesternSmall";
this.definitionText.fontPath = "fonts/WesternSmall";
gameObjects.Add(this.bonusText);
gameObjects.Add(this.resumeButton);
gameObjects.Add(this.bonusWordText);
gameObjects.Add(this.partOfSpeechText);
gameObjects.Add(this.similarToText);
gameObjects.Add(this.definitionText);
}
示例15: PopupScoreScene
public PopupScoreScene()
: base()
{
this.dismissed = true;
gameObjects = new System.Collections.Generic.List<GameObject>();
this.cursorRectangle = new Rectangle(
(int)cursor.mouse.X,
(int)cursor.mouse.Y,
1,
1
);
gameObjects.Add(new CursorGameObject(cursor));
this.sceneIndex = SceneIndex.PopupScoreScene;
this.background = new GameObject("menu/menu", new Vector2(Game1.CAMERA_WIDTH / 2, Game1.CAMERA_HEIGHT / 2));
this.background.zindex = 0.8f;
gameObjects.Add(this.background);
this.congratulationsText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 145), "Congratulations!");
this.resumeButton = new MenuItem(new Vector2(Game1.CAMERA_WIDTH / 2, 345), "Resume");
this.longestWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 185), "Longest Word: ...");
this.highestPointWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 225), "Highest Point Word: ...");
this.mostCreatedWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 265), "Most Created Word: ...");
this.totalWordsCreatedText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 305), "Total Words Created: ...");
this.congratulationsText.zindex = .9f;
this.resumeButton.zindex = .9f;
this.longestWordText.zindex = .9f;
this.highestPointWordText.zindex = .9f;
this.mostCreatedWordText.zindex = .9f;
this.totalWordsCreatedText.zindex = .9f;
this.congratulationsText.fontPath = "fonts/Western";
this.congratulationsText.fontColor = Color.Gold;
this.resumeButton.fontPath = "fonts/Western";
this.longestWordText.fontPath = "fonts/WesternSmall";
this.highestPointWordText.fontPath = "fonts/WesternSmall";
this.mostCreatedWordText.fontPath = "fonts/WesternSmall";
this.totalWordsCreatedText.fontPath = "fonts/WesternSmall";
gameObjects.Add(this.congratulationsText);
gameObjects.Add(this.resumeButton);
gameObjects.Add(this.longestWordText);
gameObjects.Add(this.highestPointWordText);
gameObjects.Add(this.mostCreatedWordText);
gameObjects.Add(this.totalWordsCreatedText);
}