public override int GetHashCode() { int hash = 17; hash = hash * 31 + Id.GetHashCode(); hash = hash * 31 + SortNumber.GetHashCode(); hash = hash * 31 + Text.GetHashCode(); return(hash); }
static void Main(string[] args) { var sortNumber = new SortNumber(); Console.Write("Enter Number : "); string number = Console.ReadLine(); // var resultSort = sortNumber.GetFormattedString("34,67,55,33,12,28"); var resultSort = sortNumber.GetFormattedString(number); Console.Write(resultSort); }
private void SortTwoTable_Click(object sender, RoutedEventArgs e) { using (NumbersContext dbOne = new NumbersContext()) { dbOne.SortTable.Load(); var sort_tab = dbOne.Numbers.OrderBy(c => c.Number_Rand); Console.WriteLine(dbOne.Numbers.Count()); for (int i = 0; i < 10; i++) { SortNumber sort = new SortNumber(); Console.WriteLine(i); sort.Number_Sort = sort_tab.Select(c => c.Number_Rand).AsEnumerable().ElementAtOrDefault(i); dbOne.SortTable.Add(sort); } dbOne.SaveChanges(); dbOne.SortTable.Load(); DataGridTwo.ItemsSource = dbOne.SortTable.Local.ToBindingList(); } }
private void SortButton_Click(object sender, RoutedEventArgs e) { using (context = new NumberContext()) { context.SortNumbers.RemoveRange(context.SortNumbers); var sortNumbers = context.Numbers.OrderBy(el => el.Value).Select(el => el.Value).ToList(); foreach (var el in sortNumbers) { SortNumber element = new SortNumber(); element.Value = el; context.SortNumbers.Add(element); } context.SaveChanges(); context.SortNumbers.Load(); sortNumbersGrid.ItemsSource = context.SortNumbers.Local.ToBindingList(); } }
public int CompareTo(PlaylistItem other) { return(SortNumber.CompareTo(other)); }