当前位置: 首页>>代码示例>>C#>>正文


C# List.Add方法代码示例

本文整理汇总了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" });
        }
开发者ID:Yuanxiangz,项目名称:WorkSpace,代码行数:10,代码来源:TestModel.cs

示例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;
        }
开发者ID:RoykoSerhiy,项目名称:visualStudio_projects,代码行数:31,代码来源:ProcessExtensions.cs

示例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);
        }
开发者ID:sideproject,项目名称:WPF_PassPhraseGenerator,代码行数:31,代码来源:Utils.cs

示例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();
        }
开发者ID:ITbob,项目名称:UML2,代码行数:29,代码来源:DatabaseManager.cs

示例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;
 }
开发者ID:svaleria,项目名称:metodos-y-taller,代码行数:10,代码来源:Tokenizer.cs

示例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;
 }
开发者ID:svaleria,项目名称:metodos-y-taller,代码行数:10,代码来源:Tokenizer.cs

示例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;
 }
开发者ID:printfImNewHi,项目名称:FinalYearProject,代码行数:14,代码来源:WIAScanner.cs

示例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();
 }
开发者ID:TLandmann,项目名称:Bachelor-HSRM-Medieninformatik,代码行数:11,代码来源:MainViewModel.cs

示例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;
        }
开发者ID:TBA187,项目名称:AlcoholCalc,代码行数:21,代码来源:Controller.cs

示例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");

        }
开发者ID:InglouriousBasterd667,项目名称:ISP-labs,代码行数:13,代码来源:XML.cs

示例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;
        }
开发者ID:RuzikM,项目名称:Chat,代码行数:14,代码来源:DbControl.cs

示例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));
        }
开发者ID:JoelWeber,项目名称:xaml-sdk,代码行数:15,代码来源:MainWindow.xaml.cs

示例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;
 }
开发者ID:vit2005,项目名称:lulu-desktop-helper,代码行数:15,代码来源:MainController.cs

示例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);
        }
开发者ID:ecntrk,项目名称:Haixiu,代码行数:15,代码来源:confidence.cs

示例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;
 }
开发者ID:svaleria,项目名称:metodos-y-taller,代码行数:17,代码来源:ControlStructuresAnalizer.cs


注:本文中的WpfApplication1.List.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。