本文整理汇总了C#中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.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadAssemblies
private static System.Collections.Generic.IList<System.Reflection.Assembly> LoadAssemblies()
{
System.Collections.Generic.IList<System.Reflection.Assembly> assemblyList = new System.Collections.Generic.List<System.Reflection.Assembly>();
assemblyList.Add(Load("Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a" +
"3a"));
assemblyList.Add(Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364" +
"e35"));
assemblyList.Add(Load("System.Activities.DurableInstancing, Version=4.0.0.0, Culture=neutral, PublicKeyT" +
"oken=31bf3856ad364e35"));
assemblyList.Add(Load("System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11" +
"d50a3a"));
assemblyList.Add(Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e0" +
"89"));
assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Runtime.DurableInstancing, Version=4.0.0.0, Culture=neutral, PublicKeyToke" +
"n=31bf3856ad364e35"));
assemblyList.Add(Load("System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" +
"31bf3856ad364e35"));
assemblyList.Add(Load("System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193" +
"4e089"));
assemblyList.Add(Load("System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08" +
"9"));
assemblyList.Add(Load("YunShanOA.BusinessLogic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));
assemblyList.Add(Load("YunShanOA.DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));
assemblyList.Add(Load("YunShanOA.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));
assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly());
return assemblyList;
}
示例2: getPermutation
public static System.Collections.Generic.List<string> getPermutation(string str, int index = 0, System.Collections.Generic.List<string> sets = null)
{
if (index == str.Length)
{
return sets;
}
System.Collections.Generic.List<string> current_result = new System.Collections.Generic.List<string>();
string c = str.Substring(index, 1);
if (sets == null)
{
current_result.Add(c);
}else if (sets != null)
{
foreach (string item in sets)
{
for (int i = 0; i <= item.Length; i++)
{
current_result.Add(insertStr(item, i, c));
}
}
}
return getPermutation(str, index + 1, current_result);
}
示例3: CreateActionList
private System.Collections.Generic.List<RuleEngine.Evidence.EvidenceSpecifier> CreateActionList()
{
System.Collections.Generic.List<RuleEngine.Evidence.EvidenceSpecifier> actionList = new System.Collections.Generic.List<RuleEngine.Evidence.EvidenceSpecifier>();
actionList.Add(new RuleEngine.Evidence.EvidenceSpecifier(true, "a1"));
actionList.Add(new RuleEngine.Evidence.EvidenceSpecifier(true, "a2"));
return actionList;
}
示例4: Test1
/// <exception cref="System.Exception"></exception>
public virtual void Test1()
{
string baseName = GetBaseName();
NeoDatis.Odb.ODB odb = Open(baseName);
System.Collections.Generic.IList<NeoDatis.Odb.Test.VO.Login.Profile> profiles = new
System.Collections.Generic.List<NeoDatis.Odb.Test.VO.Login.Profile>();
profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p1", new NeoDatis.Odb.Test.VO.Login.Function
("f1")));
profiles.Add(new NeoDatis.Odb.Test.VO.Login.Profile("p2", new NeoDatis.Odb.Test.VO.Login.Function
("f2")));
NeoDatis.Odb.Test.Query.Criteria.ClassB cb = new NeoDatis.Odb.Test.Query.Criteria.ClassB
("name", profiles);
odb.Store(cb);
odb.Close();
odb = Open(baseName);
// this object is not known y NeoDatis so the query will not return anything
NeoDatis.Odb.Test.VO.Login.Profile p = new NeoDatis.Odb.Test.VO.Login.Profile("p1"
, (System.Collections.IList)null);
NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query = odb.CriteriaQuery(typeof(
NeoDatis.Odb.Test.Query.Criteria.ClassB), NeoDatis.Odb.Core.Query.Criteria.Where
.Contain("profiles", p));
NeoDatis.Odb.Objects<NeoDatis.Odb.Test.Query.Criteria.ClassB> l = odb.GetObjects(
query);
odb.Close();
AssertEquals(0, l.Count);
}
示例5: static_call
public static System.Collections.Generic.List<_Star_Double_Double> static_call(float a, float b, float c)
{
var _ret = new System.Collections.Generic.List<_Star_Double_Double>();
{
var tmp_0 = a * c;
var tmp_1 = 4 * tmp_0;
var tmp_2 = b * b;
var d = tmp_2 - tmp_1;
var tmp_3 = d > 0;
if (tmp_3) {
var tmp_4 = 0 - b;
var tmp_5 = System.Math.Sqrt(d);
var x = tmp_4 - tmp_5;
var tmp_6 = b * x;
var tmp_7 = x * x;
var tmp_8 = a * tmp_7;
var tmp_9 = tmp_6 + c;
var y = tmp_8 + tmp_9;
var tmp_10 = new _Star_Double_Double(x,y);
_ret.Add(tmp_10);
}
}
{
var tmp_0 = a * c;
var tmp_1 = 4 * tmp_0;
var tmp_2 = b * b;
var d = tmp_2 - tmp_1;
var tmp_3 = d > 0;
if (tmp_3) {
var tmp_4 = 0 - b;
var tmp_5 = System.Math.Sqrt(d);
var x = tmp_4 + tmp_5;
var tmp_6 = b * x;
var tmp_7 = x * x;
var tmp_8 = a * tmp_7;
var tmp_9 = tmp_6 + c;
var y = tmp_8 + tmp_9;
var tmp_10 = new _Star_Double_Double(x, y);
_ret.Add(tmp_10);
}
}
{
var tmp_0 = a * c;
var tmp_1 = 4 * tmp_0;
var tmp_2 = b * b;
var d = tmp_2 - tmp_1;
var tmp_3 = d == 0;
if (tmp_3) {
var x = 0 - b;
var tmp_4 = b * x;
var tmp_5 = x * x;
var tmp_6 = a * tmp_5;
var tmp_7 = tmp_4 + c;
var y = tmp_6 + tmp_7;
var tmp_8 = new _Star_Double_Double(x,y);
_ret.Add(tmp_8);
}
}
return _ret;
}
示例6: GetTLProject_broken_connection
public void GetTLProject_broken_connection()
{
System.Collections.Generic.List<TestProject> list =
new System.Collections.Generic.List<TestProject>();
list.Add(
FakeTestLinkFactory.GetTestProject(
"project1",
"prj1",
string.Empty));
list.Add(
FakeTestLinkFactory.GetTestProject(
"project2",
"prj2",
string.Empty));
list.Add(
FakeTestLinkFactory.GetTestProject(
"project3",
"prj3",
string.Empty));
//cmdlet.WriteTrace(cmdlet, "GetTLProject_broken_connection: 001");
System.Collections.Generic.List<TestProject> resultList =
getProjectCollection(list, true);
//cmdlet.WriteTrace(cmdlet, "GetTLProject_broken_connection: 002");
Assert.AreEqual<System.Collections.Generic.List<TestProject>>(
(new System.Collections.Generic.List<TestProject>()),
resultList);
}
示例7: FirefoxProfile_add_five_extensions
public void FirefoxProfile_add_five_extensions()
{
string[] expected = { "SePSX.dll", "SePSX.dll", "SePSX.dll", "SePSX.dll", "SePSX.dll" };
AddSeFirefoxExtensionCommand cmdlet =
WebDriverFactory.Container.Resolve<AddSeFirefoxExtensionCommand>();
//AddSeFirefoxExtensionCommand.UnitTestMode = true;
cmdlet.InputObject =
//WebDriverFactory.GetFirefoxProfile();
// resolve FirefoxProfile
WebDriverFactory.Container.Resolve<FirefoxProfile>();
cmdlet.ExtensionList =
expected;
SeAddFirefoxExtensionCommand command =
new SeAddFirefoxExtensionCommand(cmdlet);
command.Execute();
System.Collections.Generic.List<string> listOfArguments =
new System.Collections.Generic.List<string>();
listOfArguments.Add(expected[0]);
listOfArguments.Add(expected[1]);
listOfArguments.Add(expected[2]);
listOfArguments.Add(expected[3]);
listOfArguments.Add(expected[4]);
ReadOnlyCollection<string> expectedList =
new ReadOnlyCollection<string>(listOfArguments);
//Assert.AreEqual(expectedList, (SePSX.CommonCmdletBase.UnitTestOutput[0] as FirefoxProfile)); // ??
}
示例8: Main
static void Main(string[] args)
{
string MyDir = @"Files\";
//Initialize WorkbookDesigner object
WorkbookDesigner designer = new WorkbookDesigner();
//Load the template file
designer.Workbook = new Workbook(MyDir+"SM_NestedObjects.xlsx");
//Instantiate the List based on the class
System.Collections.Generic.ICollection<Individual> list = new System.Collections.Generic.List<Individual>();
//Create an object for the Individual class
Individual p1 = new Individual("Damian", 30);
//Create the relevant Wife class for the Individual
p1.Wife = new Wife("Dalya", 28);
//Create another object for the Individual class
Individual p2 = new Individual("Mack", 31);
//Create the relevant Wife class for the Individual
p2.Wife = new Wife("Maaria", 29);
//Add the objects to the list
list.Add(p1);
list.Add(p2);
//Specify the DataSource
designer.SetDataSource("Individual", list);
//Process the markers
designer.Process(false);
//Save the Excel file.
designer.Workbook.Save(MyDir+"out_SM_NestedObjects.xlsx");
}
示例9: CompletarPermisos
public void CompletarPermisos(FeaEntidades.InterFacturas.lote_comprobantes lc)
{
//Permisos de exportación
permisos = new System.Collections.Generic.List<FeaEntidades.InterFacturas.permisos>();
if (lc.comprobante[0].cabecera.informacion_comprobante.informacion_exportacion != null && lc.comprobante[0].cabecera.informacion_comprobante.informacion_exportacion.permisos != null)
{
foreach (FeaEntidades.InterFacturas.permisos r in lc.comprobante[0].cabecera.informacion_comprobante.informacion_exportacion.permisos)
{
//descripcioncodigo_de_permiso ( XmlIgnoreAttribute )
//Se busca la descripción a través del código.
try
{
if (r != null)
{
//string descrcodigo = ((DropDownList)permisosGridView.FooterRow.FindControl("ddlcodigo_de_permiso")).SelectedItem.Text;
//((DropDownList)permisosGridView.FooterRow.FindControl("ddlcodigo_de_permiso")).SelectedValue = r.destino_mercaderia.ToString();
//descrcodigo = ((DropDownList)permisosGridView.FooterRow.FindControl("ddlcodigo_de_permiso")).SelectedItem.Text;
//r.descripcion_destino_mercaderia = descrcodigo;
permisos.Add(r);
}
}
catch
//Referencia no valida
{
}
}
}
if (permisos.Count.Equals(0))
{
permisos.Add(new FeaEntidades.InterFacturas.permisos());
}
permisosGridView.DataSource = permisos;
permisosGridView.DataBind();
ViewState["permisos"] = permisos;
}
示例10: Dictionary_thread_test
public void Dictionary_thread_test()
{
string path = AppDomain.CurrentDomain.BaseDirectory;
Dictionary<int, int> testDictionary = new Dictionary<int, int>(path);
try
{
_error = false;
System.Collections.Generic.List<Thread> tList = new System.Collections.Generic.List<Thread>(100);
for (int i = 0; i < 20; i++)
{
Thread t = new Thread(DoWriteTest3);
tList.Add(t);
t.Start(testDictionary);
}
for (int i = 0; i < 20; i++)
{
Thread t = new Thread(DoReadTest3);
tList.Add(t);
t.Start(testDictionary);
}
foreach (Thread t in tList)
{
t.Join();
}
Assert.IsFalse(_error);
}
finally
{
testDictionary.Dispose();
}
}
示例11: getLevelLinkedList
public static System.Collections.Generic.Dictionary<System.Int16, System.Collections.Generic.List<BinaryTreeNode>> getLevelLinkedList(BinaryTreeNode head)
{
System.Collections.Generic.Dictionary<System.Int16, System.Collections.Generic.List<BinaryTreeNode>> result
= new System.Collections.Generic.Dictionary<System.Int16, System.Collections.Generic.List<BinaryTreeNode>>();
short level = 0;
System.Collections.Generic.List<BinaryTreeNode> list = new System.Collections.Generic.List<BinaryTreeNode>();
list.Add(head);
result.Add(level, list);
while (true)
{
System.Collections.Generic.List<BinaryTreeNode> list_loop = result[level];
list = new System.Collections.Generic.List<BinaryTreeNode>();
result.Add(++level, list);
foreach (BinaryTreeNode btn in list_loop)
{
if (btn.LeftNode != null)
{
list.Add(btn.LeftNode);
}
if (btn.RightNode != null)
{
list.Add(btn.RightNode);
}
}
if (list.Count == 0)
{
break;
}
}
return result;
}
示例12: Array_thread_test
public void Array_thread_test()
{
_error = false;
string path = AppDomain.CurrentDomain.BaseDirectory;
using (Array<int> testList = new Array<int>(10, path))
{
testList.AutoGrow = true;
System.Collections.Generic.List<Thread> tList = new System.Collections.Generic.List<Thread>(100);
for (int i = 0; i < 100; i++)
{
Thread t = new Thread(DoWriteTest1);
tList.Add(t);
t.Start(testList);
}
for (int i = 0; i < 100; i++)
{
Thread t = new Thread(DoReadTest1);
tList.Add(t);
t.Start(testList);
}
foreach (Thread t in tList)
{
t.Join();
}
Assert.IsFalse(_error);
}
}
示例13: GetKnownTypes
public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
{
System.Collections.Generic.List<System.Type> knownTypes =
new System.Collections.Generic.List<System.Type>();
//// Add any types to include here.
//return knownTypes;
Type[] types = Assembly.Load("SMT_FB_EFModel").GetTypes();
for (int i = 0; i < types.Length; i++)
{
if ((types[i].BaseType == typeof(EntityObject)) || typeof(VisitUserBase).IsAssignableFrom(types[i]))
{
knownTypes.Add(types[i]);
}
}
//List<Type> typesO = knownTypes.ToList();
//typesO.ForEach(item =>
//{
// knownTypes.Add(typeof(List<>).MakeGenericType(new Type[] { item }));
//});
knownTypes.Add(typeof(AuditResult));
knownTypes.Add(typeof(SaveResult));
knownTypes.Add(typeof(VirtualAudit));
knownTypes.Add(typeof(SMT.SaaS.BLLCommonServices.FlowWFService.SubmitData));
return knownTypes;
}
示例14: LoadAssemblies
private static System.Collections.Generic.IList<System.Reflection.Assembly> LoadAssemblies()
{
System.Collections.Generic.IList<System.Reflection.Assembly> assemblyList = new System.Collections.Generic.List<System.Reflection.Assembly>();
assemblyList.Add(Load("Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a" +
"3a"));
assemblyList.Add(Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364" +
"e35"));
assemblyList.Add(Load("System.Activities.DurableInstancing, Version=4.0.0.0, Culture=neutral, PublicKeyT" +
"oken=31bf3856ad364e35"));
assemblyList.Add(Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" +
""));
assemblyList.Add(Load("System.Runtime.DurableInstancing, Version=4.0.0.0, Culture=neutral, PublicKeyToke" +
"n=31bf3856ad364e35"));
assemblyList.Add(Load("System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b7" +
"7a5c561934e089"));
assemblyList.Add(Load("System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" +
"31bf3856ad364e35"));
assemblyList.Add(Load("System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193" +
"4e089"));
assemblyList.Add(Load("System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5619" +
"34e089"));
assemblyList.Add(Load("System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08" +
"9"));
assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly());
return assemblyList;
}
示例15: btnBus_Click
protected void btnBus_Click(object sender, EventArgs e)
{
int intAnio = 0;
int intMes = 0;
if (!int.TryParse(cmbAnio.SelectedValue, out intAnio) || !int.TryParse(cmbMes.SelectedValue, out intMes))
{
lblErr.Text = "El año y mes seleccionado es incorrecto";
return;
}
System.Collections.Generic.List<ReportParameter> _parameters = new System.Collections.Generic.List<ReportParameter>();
_parameters.Add(new ReportParameter("Tipo", this.cmbTip.SelectedIndex == 0 ? " " : this.cmbTip.Text));
_parameters.Add(new ReportParameter("Grupo", this.cmbGru.SelectedIndex == 0 ? " " : this.cmbGru.Text));
_parameters.Add(new ReportParameter("Area", this.cmbAre.SelectedIndex == 0 ? " " : this.cmbAre.Text));
_parameters.Add(new ReportParameter("fechaIni", UtilFechas.getFechaIni(intAnio,intMes).ToString("yyyyMMdd")));
_parameters.Add(new ReportParameter("fechaFin", UtilFechas.getFechaFin(intAnio, intMes).ToString("yyyyMMdd")));
try
{
this.rpvData.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
this.rpvData.ShowParameterPrompts = false;
this.rpvData.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerUrl"]);
this.rpvData.ServerReport.ReportPath = "/rptTablero/rptAnalisisSLA";
this.rpvData.ServerReport.SetParameters(_parameters);
this.rpvData.ServerReport.Refresh();
this.rpvData.Visible = true;
}
catch (Exception ex)
{
this.rpvData.Visible = false;
this.lblErr.Text = ex.Message + "<br/>" + ex.StackTrace;
}
}