本文整理汇总了C#中WpfApplication1.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# List.Add方法的具体用法?C# List.Add怎么用?C# List.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WpfApplication1.List
的用法示例。
在下文中一共展示了List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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" });
}
示例2: 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;
}
示例3: 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);
}
示例4: checkProjects
public List<String> checkProjects()
{
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"]);
if (!File.Exists(reader["address"].ToString()))
list.Add(reader["address"].ToString());
}
}
con.Close();
}
}
if(list.Count > 0)
removeProject(list);
return getLastProjects();
}
示例5: 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;
}
示例6: separadorLineas
public List<string> separadorLineas(string cadena)
{
List<string> tokenizer = new List<string>();
string[] n = cadena.Split(new string[] { Environment.NewLine}, StringSplitOptions.None );
foreach (string item in n)
{
tokenizer.Add(item);
}
return tokenizer;
}
示例7: 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;
}
示例8: MainViewModel
public MainViewModel()
{
CurrentColor = GetPaletteColor();
Model = new Model3DGroup();
Voxels = new List<Voxel>();
Highlighted = new List<Model3D>();
ModelToVoxel = new Dictionary<Model3D, Voxel>();
OriginalMaterial = new Dictionary<Model3D, Material>();
Voxels.Add(new Voxel(new Point3D(0, 0, 0), CurrentColor));
UpdateModel();
}
示例9: CreatePersons
public List<Person> CreatePersons()
{
List<Person> personlist = new List<Person>();
Person person1 = new Person();
Person person2 = new Person();
personlist.Add(person1);
personlist.Add(person2);
person1.Username = "Ivan123";
person1.Password = "123ivan";
person1.Gender = "Male";
person1.Weight = 110;
person2.Username = "Ida123";
person2.Password = "123ida";
person2.Gender = "Female";
person2.Weight = 50;
return personlist;
}
示例10: Main
static void Main(string[] args)
{
Matrix mat = new Matrix(2, 2);
mat.Initialize(20);
int a = 33;
Serializer x = new Serializer();
List<int> l = new List<int>();
l.Add(5);
x.WriteObject(mat,@"C:\qwer.xml");
var b = x.ReadObject(@"C:\qwer.xml");
}
示例11: GetUsersList
public List<string> GetUsersList()
{
List<string> userlist = new List<string>();
Usersname.CommandText = "SELECT name FROM message";
SQLiteDataReader r = Usersname.ExecuteReader();
while (r.Read())
{
userlist.Add(Convert.ToString(r["name"]));
}
return userlist;
}
示例12: MainWindow
public MainWindow()
{
InitializeComponent();
List<Location> locations = new List<Location>();
locations.Add(new Location() { ContinentCode = "EU", CountryID = 2 });
((GridViewComboBoxColumn)this.radGridView.Columns[0]).ItemsSource = Locations.Continents;
this.radGridView.ItemsSource = locations;
//We need to sense when the combo selection is changed and submit the value immediately
//otherwise the value will be submited on leaving the cell which is too late for our needs.
this.AddHandler(RadComboBox.SelectionChangedEvent, new System.Windows.Controls.SelectionChangedEventHandler(comboSelectionChanged));
}
示例13: LoadMusic
public List<string> LoadMusic()
{
List<string> data = new List<string>();
try
{
string line;
System.IO.StreamReader file = new System.IO.StreamReader("radio.txt");
while ((line = file.ReadLine()) != null)
{
data.Add(line);
}
}
catch (Exception) { }
return data;
}
示例14: evaluateConfidence
public void evaluateConfidence(double[] data)
{
output = this.confiRecog.recognizeEmotion(data);
List<KeyValuePair<double, int>> lst = new List<KeyValuePair<double,int>>();
//checking for multiple emo category:
for (int i = 0; i < this.emoCategory; i++)
{
if (output[i] > this.emoThreshold)
{
lst.Add(new KeyValuePair<double, int>(output[i], i));
}
}
getConfidence(lst);
}
示例15: ForStatementAnalizer
public List<string> ForStatementAnalizer(string forStatement)
{
string aux = statementFilter(forStatement, "for");
var forValues = new List<string>();
if (!aux.Contains("Error"))
{
var iteratRestrict = aux.Split(';');
foreach (string rest in iteratRestrict)
{
forValues.Add(rest);
}
if (forValues.Count != 3) {
/////verificar asignacion de variable como primera entrada(int i = 0), condicion(i<n) y expresion final(i++)////////////
}
}
return forValues;
}