本文整理汇总了C#中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.List类的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("HRApplicationServices.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken" +
"=null"));
assemblyList.Add(Load("HRApplicationServices.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" +
""));
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.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.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934" +
"e089"));
assemblyList.Add(Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b7" +
"7a5c561934e089"));
assemblyList.Add(Load("System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a"));
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.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"));
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;
}
示例2: 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.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b" +
"77a5c561934e089"));
assemblyList.Add(Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50" +
"a3a"));
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.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a"));
assemblyList.Add(Load("System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5619" +
"34e089"));
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;
}
示例3: run
private static int run(string[] args, Ice.Communicator communicator)
{
System.Collections.Generic.List<int> ports = new System.Collections.Generic.List<int>();
for(int i = 0; i < args.Length; i++)
{
int port = 0;
try
{
port = System.Int32.Parse(args[i]);
}
catch(System.FormatException ex)
{
System.Console.Error.WriteLine(ex);
return 1;
}
ports.Add(port);
}
if(ports.Count == 0)
{
System.Console.Error.WriteLine("Client: no ports specified");
usage();
return 1;
}
AllTests.allTests(communicator, ports);
return 0;
}
示例4: BuildUri
internal override string BuildUri(string baseUri, string accesskey)
{
// assume no batch id nor events
string usingBatch = String.Empty;
string usingEvents = String.Empty;
// if the user has passed a batch id, build that portion of the query string request
if (!String.IsNullOrEmpty(BatchId))
{
usingBatch = String.Format("&batchid={0}", HttpUtility.UrlEncode(BatchId));
}
// if the user has passed event ids, build that portion of the query string request
if (EventIds != null)
{
if (EventIds.Count() != 0)
{
// URLEncode each event id
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
foreach (var ev in EventIds)
{
list.Add(HttpUtility.UrlEncode(ev));
}
// Build the event ids string
string idString = String.Join("_", list.ToArray());
usingEvents = String.Format("&eventids={0}", idString);
}
}
// build the uri
return String.Concat(baseUri, String.Format(c_removeeventscommand, accesskey, usingBatch, usingEvents));
}
示例5: LoadScene
//public GameObject loadingImage;
public void LoadScene(string level)
{
Data.noMissions = false;
System.Collections.Generic.List<Mission> tempList = new System.Collections.Generic.List<Mission>();
for (int i = 0; i < Data.diplomacyList.Count; i++)
{
if (Data.diplomacyList[i].difficulty == Data.currentDifficulty && !Data.diplomacyList[i].isDone)
{
tempList.Add(Data.diplomacyList[i]);
}
}
System.Random r = new System.Random();
int randomIndex = r.Next(0, tempList.Count);
if (tempList.Count == 0)
{
//hotdogs
}
else if (!Data.preserveDipMission || !Data.lastDipMission.isListed)
{
Debug.Log("Random mission: " + randomIndex + " out of: " + tempList.Count);
Data.pickedMission = tempList[randomIndex];
Data.lastDipMission = Data.pickedMission;
Data.lastDipMission.isListed = true;
}
else
{
Data.pickedMission = Data.lastDipMission;
}
tempList.Clear();
Data.hitBack = false;
//loadingImage.SetActive(true);
Application.LoadLevel(level);
}
示例6: getPermutationV5
//Idea of Recursive
public static System.Collections.Generic.List<string> getPermutationV5(string str)
{
if (str == null)
{
return null;
}
System.Collections.Generic.List<string> solutions = new System.Collections.Generic.List<string>();
if (str.Length == 0)
{
solutions.Add("");
return solutions;
}
//solutions.Add(str[0].ToString());
string remaining = str.Substring(1);
System.Collections.Generic.List<string> current_solutions = getPermutationV5(remaining);
foreach (string item in current_solutions)
{
for (int i = 0; i <= item.Length; i++)
{
string new_item = insertStr(item, i, str[0].ToString());
solutions.Add(new_item);
}
}
return solutions;
}
示例7: Test1
public virtual void Test1()
{
int size = 100000;
int[] arrayOfInts = new int[size];
System.Collections.Generic.IList<int> listOfInts = new System.Collections.Generic.List
<int>(size);
long startArray = OdbTime.GetCurrentTimeInMs();
for (int i = 0; i < size; i++)
{
arrayOfInts[i] = i;
}
for (int i = 0; i < size; i++)
{
int ii = arrayOfInts[i];
}
long endArray = OdbTime.GetCurrentTimeInMs();
long startList = OdbTime.GetCurrentTimeInMs();
for (int i = 0; i < size; i++)
{
listOfInts.Add(i);
}
for (int i = 0; i < size; i++)
{
int ii = listOfInts[i];
}
long endList = OdbTime.GetCurrentTimeInMs();
Println("Time for array = " + (endArray - startArray));
Println("Time for list = " + (endList - startList));
}
示例8: OverlappingIdentifierFails
public void OverlappingIdentifierFails()
{
// Assert
var start = new DateTime(1999, 1, 1);
var finish = new DateTime(2020, 12, 31);
var validity = new DateRange(start, finish);
var system = new SourceSystem { Name = "Test" };
var expected = new SourceSystemMapping { System = system, MappingValue = "1", Validity = validity };
var list = new System.Collections.Generic.List<SourceSystemMapping> { expected };
var repository = new Mock<IRepository>();
repository.Setup(x => x.Queryable<SourceSystemMapping>()).Returns(list.AsQueryable());
var identifier = new EnergyTrading.Mdm.Contracts.MdmId
{
SystemName = "Test",
Identifier = "1",
StartDate = start.AddHours(5),
EndDate = start.AddHours(10)
};
var request = new AmendMappingRequest() { EntityId = 1, Mapping = identifier, MappingId = 1 };
var rule = new AmendMappingNoOverlappingRule<SourceSystemMapping>(repository.Object);
// Act
var result = rule.IsValid(request);
// Assert
repository.Verify(x => x.Queryable<SourceSystemMapping>());
Assert.IsFalse(result, "Rule failed");
}
示例9: buildPhoneNumbers
private static System.String[] buildPhoneNumbers(System.String number1, System.String number2, System.String number3)
{
// System.Collections.ArrayList numbers = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(3)); // commented by .net follower (http://dotnetfollower.com)
System.Collections.Generic.List<Object> numbers = new System.Collections.Generic.List<Object>(3); // added by .net follower (http://dotnetfollower.com)
if (number1 != null)
{
numbers.Add(number1);
}
if (number2 != null)
{
numbers.Add(number2);
}
if (number3 != null)
{
numbers.Add(number3);
}
int size = numbers.Count;
if (size == 0)
{
return null;
}
System.String[] result = new System.String[size];
for (int i = 0; i < size; i++)
{
result[i] = ((System.String) numbers[i]);
}
return result;
}
示例10: 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);
}
示例11: ExtractRenderMesh
public static Rhino.Commands.Result ExtractRenderMesh(Rhino.RhinoDoc doc)
{
Rhino.DocObjects.ObjRef objRef = null;
Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", false, Rhino.DocObjects.ObjectType.Brep, out objRef);
if (rc != Rhino.Commands.Result.Success)
return rc;
Rhino.DocObjects.RhinoObject obj = objRef.Object();
if (null == obj)
return Rhino.Commands.Result.Failure;
System.Collections.Generic.List<Rhino.DocObjects.RhinoObject> objList = new System.Collections.Generic.List<Rhino.DocObjects.RhinoObject>(1);
objList.Add(obj);
Rhino.DocObjects.ObjRef[] meshObjRefs = Rhino.DocObjects.RhinoObject.GetRenderMeshes(objList, true, false);
if (null != meshObjRefs)
{
for (int i = 0; i < meshObjRefs.Length; i++)
{
Rhino.DocObjects.ObjRef meshObjRef = meshObjRefs[i];
if (null != meshObjRef)
{
Rhino.Geometry.Mesh mesh = meshObjRef.Mesh();
if (null != mesh)
doc.Objects.AddMesh(mesh);
}
}
doc.Views.Redraw();
}
return Rhino.Commands.Result.Success;
}
示例12: getProjectCollection
private System.Collections.Generic.List<TestProject> getProjectCollection(
System.Collections.Generic.List<TestProject> listOfProjects,
bool makeFail)
{
TLProjectCmdletBase cmdlet = new TLProjectCmdletBase();
cmdlet.Name = null;
TLAddinData.CurrentTestLinkConnection =
FakeTestLinkFactory.GetTestLinkWithProjects(listOfProjects);
if (makeFail) {
TLAddinData.CurrentTestLinkConnection = null;
}
//cmdlet.WriteTrace(cmdlet, "getProjectCollection: 003");
TLSrvGetProjectCommand command =
new TLSrvGetProjectCommand(cmdlet);
command.Execute();
//cmdlet.WriteTrace(cmdlet, "getProjectCollection: 004");
System.Collections.Generic.List<TestProject> resultList =
new System.Collections.Generic.List<TestProject>();
//cmdlet.WriteTrace(cmdlet, "getProjectCollection: 005");
//cmdlet.WriteTrace(cmdlet, "IsInitialized: " + PSTestLib.UnitTestOutput.IsInitialized.ToString());
foreach (object tpr in PSTestLib.UnitTestOutput.LastOutput) {
//cmdlet.WriteTrace(cmdlet, "getProjectCollection: 006");
resultList.Add((TestProject)tpr);
//cmdlet.WriteTrace(cmdlet, "getProjectCollection: 007");
}
return resultList;
}
示例13: Run
public static void Run()
{
// ExStart:1
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// ****** Program ******
// Initialize WorkbookDesigner object
WorkbookDesigner designer = new WorkbookDesigner();
// Load the template file
designer.Workbook = new Workbook(dataDir + "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(dataDir+ "output.xlsx");
}
示例14: 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;
}
}
示例15: 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("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
assemblyList.Add(Load("PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856a" +
"d364e35"));
assemblyList.Add(Load("System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364" +
"e35"));
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.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.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("Microsoft.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad" +
"364e35"));
assemblyList.Add(Load("Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, Pub" +
"licKeyToken=71e9bce111e9429c"));
assemblyList.Add(Load("Microsoft.SharePoint.DesignTime.Activities, Version=14.0.0.0, Culture=neutral, Pu" +
"blicKeyToken=b03f5f7f11d50a3a"));
assemblyList.Add(Load("Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce11" +
"1e9429c"));
assemblyList.Add(System.Reflection.Assembly.GetExecutingAssembly());
return assemblyList;
}