本文整理汇总了C#中WpfApplication1.List类的典型用法代码示例。如果您正苦于以下问题:C# List类的具体用法?C# List怎么用?C# List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
List类属于WpfApplication1命名空间,在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public static bool Read(string filePath)
{
try
{
var reader = new StreamReader(File.OpenRead(@filePath));
fileNames = new List<string>();
utterances = new List<string>();
count = 0;
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
var values = line.Split('\t');
fileNames.Add(values[0]);
utterances.Add(values[1]);
count += 1;
}
curIndex = 0;
Console.WriteLine(fileNames.ToString());
return true;
}
catch (Exception e)
{
return false;
}
}
示例2: verificarLLaves
public string verificarLLaves(List<string> text)
{
entrada.Clear();
salida.Clear();
//buscamos en el texto las { y } y guardamos sus posiciones
for (int i = 0; i < text.Count; i++)
{
if (text[i].Contains("{"))
{
addEntada(i);
}
if (text[i].Contains("}"))
{
addSalida(i);
}
}
if (ControlLLaves() == -1) // si el numero de { y } son iguales
{
return controlParentesis(text);//llamamos a control de ( )
}
else
{
return "se esperaba } de la linea: " + ControlLLaves().ToString();
}
}
示例3: get_artists
public async Task get_artists()
{
// arrange
var asyncWebClient = Substitute.For<IAsyncWebClient>();
var artists = new List<Artist>();
var cancellationTokenSource = new CancellationTokenSource();
var artist = new Artist
{
name = "Jake",
image = new[]{new Image{ size = "small", text = "http://localhost/image.png"}}
};
asyncWebClient
.GetStringAsync(Arg.Any<Uri>(), cancellationTokenSource.Token)
.Returns(Task.FromResult(JsonConvert.SerializeObject(new Wrapper { Artists = new Artists { artist = new[]{artist }} })));
asyncWebClient
.GetDataAsync(Arg.Any<Uri>())
.Returns(Task.FromResult(new byte[0]));
// act
await MainWindow.GetArtistsAsync(asyncWebClient, cancellationTokenSource.Token,
new TestProgress<Artist>(artists.Add), bytes => null);
// assert
Assert.Equal(1, artists.Count);
Assert.Equal("Jake", artists[0].name);
}
示例4: getLastProjects
public List<String> getLastProjects()
{
List<String> list = new List<String>();
using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection("data source=databaseFile.db3"))
{
using (System.Data.SQLite.SQLiteCommand com = new System.Data.SQLite.SQLiteCommand(con))
{
con.Open();
com.CommandText = "Select * FROM LASTPROJECTS";
using (System.Data.SQLite.SQLiteDataReader reader = com.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine(reader["address"]);
list.Add(reader["address"].ToString());
}
}
con.Close();
}
}
return list;
}
示例5: TestCutByLine_Common1
public void TestCutByLine_Common1()
{
var lstC = new List<VertexBase>
{
new Vertex(4, 8),
new Vertex(12, 9),
new Vertex(14, 1),
new Vertex(2, 3),
new Vertex(4, 8)
};
//S1S5切割多边形
var polyC = new LinkedList<VertexBase>(lstC);
var inters = CutByLine(new Vertex(2, 12), new Vertex(10, 1), polyC);
Assert.True(inters.Count == 2 && polyC.Count == 7);
//S2S1切割多边形
polyC = new LinkedList<VertexBase>(lstC);
inters = CutByLine(new Vertex(6, -2), new Vertex(2, 12), polyC);
Assert.True(inters.Count == 2 && polyC.Count == 7);
// S5S4切割多边形
// 测试虚交点
polyC = new LinkedList<VertexBase>(lstC);
inters = CutByLine(new Vertex(10, 1), new Vertex(12, 5), polyC);
Assert.True(inters.Count == 1 && polyC.Count == 6);
}
示例6: TestCutByLineForCrossDi_Common1
public void TestCutByLineForCrossDi_Common1()
{
//S1S5切割多边形
//普通情况
var polyC = new List<VertexBase>
{
new Vertex(4, 8),
new Vertex(12, 9),
new Vertex(14, 1),
new Vertex(2, 3),
new Vertex(4, 8)
};
var inters = CutByLineForCrossDi(new Vertex(2, 12), new Vertex(10, 1), polyC, false);
Assert.True(inters.Item1 == CrossInOut.In && inters.Item2 == 0 && inters.Item3);
inters = CutByLineForCrossDi(new Vertex(10, 1), new Vertex(2, 12), polyC, false);
Assert.True(inters.Item1 == CrossInOut.In && inters.Item2 == 2 && inters.Item3);
var polyS = new List<VertexBase>
{
new Vertex(2, 12),
new Vertex(10, 1),
new Vertex(12, 5),
new Vertex(13, 0),
new Vertex(6, -2),
new Vertex(2, 12)
};
var inters2 = CutByLineForCrossDi(new Vertex(14, 1), new Vertex(2, 3), polyS, true, 0);
Assert.True(inters2.Item1 == CrossInOut.In && inters2.Item2 == 0 && inters2.Item3);
}
示例7: GeneratePassPhrases
public static System.Collections.ObjectModel.ObservableCollection<string> GeneratePassPhrases()
{
if (!System.IO.File.Exists("words.txt"))
DownloadWordList();
if (!System.IO.File.Exists("words.txt"))
throw new Exception("Could not download word list");
string[] words = System.IO.File.ReadAllLines("words.txt");
List<string> phrases = new List<string>();
for (int j = 0; j < 1000; j++)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 4; i++)
{
if (i > 0) sb.Append(" ");
int d = Randomness.GetValue(0, words.Length - 1);
string word = words[d];
if (i == 0 && word.Length > 1)
word = word.Capitalize();
sb.Append(word);
}
sb.Append(".....");
phrases.Add(sb.ToString());
}
return new System.Collections.ObjectModel.ObservableCollection<string>(phrases);
}
示例8: dynamicDetection
public dynamicDetection(String s)
{
this.recog = new recognizer(s);
//this.file = new System.IO.StreamWriter("C:\\Users\\workshop\\Desktop\\11122.csv");
this.iter = 0;
this.frame = 0;
this.feature = new _feature(0.0);
//this.featureSet = new double[20];
this.wDist = new double[4];
this.wDistLeg = new double[4];
this.prevAccel = new double[4];
this.prevAccelLeg = new double[4];
this.prevSpeed = new double[4];
this.prevSpeedLeg = new double[4];
this.totJI = new double[4];
this.wprevLeg = new _qbit[4];
this.wprev = new _qbit[4];
this.featureList = new List<double[]>();
refreshVars();
}
示例9: GetChildProcesses
/// <summary>
/// Get the child processes for a given process
/// </summary>
/// <param name="process"></param>
/// <returns></returns>
public static List<Process> GetChildProcesses(this Process process)
{
var results = new List<Process>();
// query the management system objects for any process that has the current
// process listed as it's parentprocessid
string queryText = string.Format("select processid from win32_process where parentprocessid = {0}", process.Id);
using (var searcher = new ManagementObjectSearcher(queryText))
{
foreach (var obj in searcher.Get())
{
object data = obj.Properties["processid"].Value;
if (data != null)
{
// retrieve the process
var childId = Convert.ToInt32(data);
var childProcess = Process.GetProcessById(childId);
// ensure the current process is still live
if (childProcess != null)
results.Add(childProcess);
}
}
}
return results;
}
示例10: selectedCellsChangedHandler
private void selectedCellsChangedHandler(object param = null)
{
IEnumerable<object> selected = param as IEnumerable<object>;
var selectedDataItems = selected.Cast<DataItemViewModel>().ToList();
// Clone the SelectedEntries
List<DataItemViewModel> clonedSelectedEntries = new List<DataItemViewModel>(selectedDataItems);
// keep the previous entry that is part of the selection
DataItemViewModel previousSelectedItem = null;
// Keep the previous entry that is in the list
DataItemViewModel previousItem = null;
// build list backwards so that diffs happen in order going up
int viewCount = Data.Count;
for (int i = viewCount - 1; i >= 0; i--)
{
// Get current item in the list
var currentItem = Data[i] as DataItemViewModel;
// If the item is part of the selection we will want some kind of diff
if (clonedSelectedEntries.Contains(currentItem))
{
// If the previous selected item is null
// this means that it is the bottom most item in the selection
// and compare it to the previous non selected string
if (previousSelectedItem != null)
{
currentItem.PrevName = previousSelectedItem.Name;
currentItem.IsVisualDiffVisible = true;
}
else if (previousItem != null) // if there is a previous selected item compare the item with that one
{
currentItem.PrevName = previousItem.Name;
currentItem.IsVisualDiffVisible = true;
}
else //the selected item is the bottom item with nothing else to compare, so just show differences from an empty string
{
currentItem.PrevName = String.Empty;
currentItem.IsVisualDiffVisible = true;
}
// Set the previously selected item to the current item to keep for comparison with the next selected item on the way up
previousSelectedItem = currentItem;
// clean up
clonedSelectedEntries.Remove(currentItem);
}
else // if item is not part of the selection we will want the original text
{
currentItem.PrevName = String.Empty;
currentItem.IsVisualDiffVisible = false;
}
// regardless of whether item is in selection or not we keep it as the previous item when we move up to the next one
previousItem = currentItem;
}
}
示例11: Main
static void Main(string[] args)
{
ControlStructuresAnalizer csa = new ControlStructuresAnalizer();
List<string> forloop = new List<string>();
forloop = csa.ForStatementAnalizer("for(int i = 0; i < n; i++)");
Console.WriteLine(forloop[0].ToString());
Console.ReadKey();
}
示例12: SaveTimerValue
public static void SaveTimerValue(List<TimeSpan> items)
{
if( items.Count == 0 )
{
return;
}
File.WriteAllLines(outputValueFileName, items.Select(c => c.ToString(@"hh\:mm\:ss")));
}
示例13: GetDevices
/// <summary>
/// Gets the list of available WIA devices.
/// </summary>
/// <returns></returns>
public static List<string> GetDevices()
{
List<string> devices = new List<string>();
WIA.DeviceManager manager = new WIA.DeviceManager();
foreach (WIA.DeviceInfo info in manager.DeviceInfos)
{
devices.Add(info.DeviceID);
}
return devices;
}
示例14: separadorEspacios
public List<string> separadorEspacios(string cadena)
{
List<string> tokenizer = new List<string>();
string [] n = cadena.Split(' ');
foreach (string item in n)
{
tokenizer.Add(item);
}
return tokenizer;
}
示例15: TestModel
public TestModel()
{
BlotterCommandList = new List<BlotterCommand>();
BlotterCommandList.Add(new BlotterCommand() { CommandType = BlotterCommandType.Create, CommandHandler = () => MessageBox.Show("Create button!"), LayOut = BlotterCommandLayOut.Botton });
BlotterCommandList.Add(new BlotterCommand() { CommandType = BlotterCommandType.Delete, CommandHandler = () => MessageBox.Show("Delete button!"), LayOut = BlotterCommandLayOut.Botton });
Elements = new List<object>();
Elements.Add(new Car() { Name = "Benz" });
Elements.Add(new Desk() { Name = "HighDesk" });
}