static void Main(string[] args) { Mylist <string> mylist = new Mylist <string>(); mylist.Add("Ali"); mylist.Add("Veli"); }
static void Main(string[] args) { string[] isimler = new string[] { "Emre", "Melih", "Halil", "Mehmet" }; Console.WriteLine(isimler[0]); Console.WriteLine(isimler[1]); Console.WriteLine(isimler[2]); //4 elelmanlı bir dizinin içine 5.elemanı böyle koyamayız //çünkü new heap'de yeni bir referans alıyor ve 5 elemanlı ancak 4 elemanı boş olan bir dizi oluşturuyor isimler = new string[5]; Console.WriteLine(4); Console.WriteLine(1); //Yanda çıkan ampulden using System.Collections.Generic; eklemelisin //List ile koleksiyon kuruluyor ! List <string> isimler2 = new List <string> { "Emre", "Melih", "Halil", "Mehmet" }; Console.WriteLine(isimler2[0]); Console.WriteLine(isimler2[1]); Console.WriteLine(isimler2[2]); //Bu şekilde yeni eleman eklenir isimler2.Add("Emin"); Console.WriteLine(isimler2[4]); Mylist <string> games = new Mylist <string> (); games.Add("csgo"); games.Add("pubg"); }
public Mylist <int> GetNextLevel(Mylist <int> olddic) { Mylist <int> newlist = new Mylist <int>(); newlist.Add(0, 1); for (int i = 0; i < olddic.Count() - 1; i++) { newlist.Add(i + 1, olddic[i] + olddic[i + 1]); } newlist.Add(olddic.Count(), 1); return(newlist); }
public Mylist <Mylist <int> > Generate(int numRows) { Mylist <Mylist <int> > result = new Mylist <Mylist <int> >(); Mylist <int> mylist = new Mylist <int>(); if (numRows > 0) { mylist.Add(0, 1); result.Add(0, mylist); for (int i = 1; i < numRows; i++) { result.Add(i, GetNextLevel(result.GetbyKey(i - 1))); } } return(result); }
static void Main(string[] args) { Mylist <int> myint = new Mylist <int>(); myint.Add(1); myint.Add(12312); Console.WriteLine(myint[0]); Console.WriteLine(myint[1]); Console.WriteLine(myint.Count); Console.WriteLine(myint.Exist(5)); Mylist <string> mystring = new Mylist <string>(); mystring.Add("stroka"); mystring.Add("ewe stroka"); Console.WriteLine(mystring[0]); Console.WriteLine(mystring[1]); Console.WriteLine(mystring["stroka"]); Console.WriteLine(mystring.Count); Console.WriteLine(mystring.Exist("strhoka")); int[] a = myint.GetArray(); for (int i = 0; i < a.Length; i++) { Console.Write("{0} ", a[i]); } string[] str = mystring.GetArray(); for (int i = 0; i < str.Length; i++) { Console.Write("{0} ", str[i]); } Console.ReadKey(); }
//更新 public void Refresh() { IsActive = true; Task.Run(() => { Mylist.Clear(); foreach (var data in MylistViewModel.MylistInstance.GetMylist(Group.Id)) { Mylist.Add(new MylistListEntryViewModel(this, data)); } //エディットモードの情報をクリア EditModeViewModel.AllSelect = false; EditModeViewModel.IsAnyoneChecked = false; IsActive = false; }); }
/* * <ComboBoxItem Content="登録が新しい順" /> * <ComboBoxItem Content="登録が古い順" /> * <ComboBoxItem Content="タイトル昇順" /> * <ComboBoxItem Content="タイトル降順" /> * <ComboBoxItem Content="マイリストコメント昇順" /> * <ComboBoxItem Content="マイリストコメント降順" /> * <ComboBoxItem Content="投稿が新しい順" /> * <ComboBoxItem Content="投稿が古い順" /> * <ComboBoxItem Content="再生数が多い順" /> * <ComboBoxItem Content="再生数が少ない順" /> * <ComboBoxItem Content="コメントが新しい順" /> * <ComboBoxItem Content="コメントが古い順" /> * <ComboBoxItem Content="コメントが多い順" /> * <ComboBoxItem Content="コメントが少ない順" /> * <ComboBoxItem Content="マイリスト登録が多い順" /> * <ComboBoxItem Content="マイリスト登録が少ない順" /> */ //ソート public void Sort(int index) { IOrderedEnumerable <MylistListEntryViewModel> sorted = null; if (Mylist == null) { return; } var tmp = Mylist.ToArray(); //並び替え switch (index) { case 0: sorted = tmp.OrderByDescending(r => r.Entry.CreateTime); break; case 1: sorted = tmp.OrderBy(r => r.Entry.CreateTime); break; case 2: sorted = tmp.OrderBy(r => r.Entry.Title); break; case 3: sorted = tmp.OrderByDescending(r => r.Entry.Title); break; case 4: sorted = tmp.OrderBy(r => r.Entry.Description); break; case 5: sorted = tmp.OrderByDescending(r => r.Entry.Description); break; case 6: sorted = tmp.OrderByDescending(r => r.Entry.FirstRetrieve); break; case 7: sorted = tmp.OrderBy(r => r.Entry.FirstRetrieve); break; case 8: sorted = tmp.OrderByDescending(r => r.Entry.ViewCounter); break; case 9: sorted = tmp.OrderBy(r => r.Entry.ViewCounter); break; case 10: sorted = tmp.OrderByDescending(r => r.Entry.UpdateTime); break; case 11: sorted = tmp.OrderBy(r => r.Entry.UpdateTime); break; case 12: sorted = tmp.OrderByDescending(r => r.Entry.CommentCounter); break; case 13: sorted = tmp.OrderBy(r => r.Entry.CommentCounter); break; case 14: sorted = tmp.OrderByDescending(r => r.Entry.MylistCounter); break; case 15: sorted = tmp.OrderBy(r => r.Entry.MylistCounter); break; } //一度空にする Mylist.Clear(); //ソートしたマイリストを再度追加 foreach (var entry in sorted) { Mylist.Add(entry); } }
public void Add(string carname, DateTime date) { CarName.Add(carname); CarDate.Add(date); }
public void AddDictionary(TKey key, TValue value) { Tkey.Add(key); Tvalue.Add(value); }