static void Main(string[] args) { Edition ed1 = new Edition(); ed1.EdName = "Ed Times"; ed1.Circulation = -322; ed1.EdTime = new DateTime(1979, 12, 01); Edition ed2 = new Edition(); ed2.EdName = "Ed Times"; ed2.Circulation = -322; ed2.EdTime = new DateTime(1979, 12, 01); Console.WriteLine(ed1.GetHashCode()); Console.WriteLine(ed2.GetHashCode()); Console.WriteLine(ed1); Console.WriteLine(ed2); Magazine magazine = new Magazine(); Console.WriteLine(magazine.ToShortString()); Console.WriteLine("The magazine is published every week: {0}", magazine[Frequency.Weekly]); Console.WriteLine("The magazine is published every month: {0}", magazine[Frequency.Monthly]); Console.WriteLine("The magazine is published every year: {0}", magazine[Frequency.Yearly]); Console.WriteLine("\n########################################################################\n"); magazine.EdName = "New York Times"; magazine.Circulation = 1488; magazine.GSFreq = Frequency.Monthly; Console.WriteLine("The magazine is published every month: {0}\n", magazine[Frequency.Monthly]); magazine.AddArticles(new Article(new Person("Vitaliy", "Goryanets", DateTime.Now), "Guide how to fish 100kg per hour", 93.3)); magazine.AddArticles(new Article(new Person("Vladimir", "Putin", new DateTime(1971, 12, 12)), "Drinking vodka without getting drunk", 99.9)); magazine.AddArticles(new Article(new Person("Danylo", "Velychko", new DateTime(1988, 2, 3)), "How to make ollie on skate", 3.1)); Console.WriteLine(magazine); Console.WriteLine("\nAvarage rating: {0}", magazine.AvgRating); object mclone = magazine.DeepCopy(); magazine.EdName = "New Times Times"; Console.WriteLine(magazine); Console.WriteLine(mclone); Console.WriteLine("Enter rating to search to"); foreach (Article a in magazine.GetRate(Convert.ToDouble(Console.ReadLine()))) { Console.WriteLine(a.Rating); } Console.WriteLine("Enter word to search to"); foreach (Article a in magazine.GetTitle(Console.ReadLine())) { Console.WriteLine(a.Title); } }
public override int GetHashCode() { const int number = 15; int hashCode = 3; hashCode = hashCode * Isbn.GetHashCode() + number; hashCode = hashCode * Author.GetHashCode() + number; hashCode = hashCode * Name.GetHashCode() + number; hashCode = hashCode * Edition.GetHashCode() + number; hashCode = hashCode * EditionYear.GetHashCode() + number; hashCode = hashCode * Pages.GetHashCode() + number; hashCode = hashCode * Price.GetHashCode() + number; return(hashCode); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (isset.read_only) { hashcode = hashcode * 397 + Read_only.GetHashCode(); } if (isset.version) { hashcode = hashcode * 397 + Version.GetHashCode(); } if (isset.rendering_enabled) { hashcode = hashcode * 397 + Rendering_enabled.GetHashCode(); } if (isset.start_time) { hashcode = hashcode * 397 + Start_time.GetHashCode(); } if (isset.edition) { hashcode = hashcode * 397 + Edition.GetHashCode(); } if (isset.host_name) { hashcode = hashcode * 397 + Host_name.GetHashCode(); } if (isset.poly_rendering_enabled) { hashcode = hashcode * 397 + Poly_rendering_enabled.GetHashCode(); } if (isset.role) { hashcode = hashcode * 397 + Role.GetHashCode(); } } return(hashcode); }
public override int GetHashCode() { unchecked { var hashCode = (Authors1 != null? Authors1.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Title != null? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Authors2 != null? Authors2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ HasOtherAuthors.GetHashCode(); hashCode = (hashCode * 397) ^ (Editor != null? Editor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ HasOtherEditors.GetHashCode(); hashCode = (hashCode * 397) ^ Edition.GetHashCode(); hashCode = (hashCode * 397) ^ (PublisherCity != null? PublisherCity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PublisherName != null? PublisherName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PublisherYear.GetHashCode(); hashCode = (hashCode * 397) ^ Pages.GetHashCode(); hashCode = (hashCode * 397) ^ PageStart.GetHashCode(); hashCode = (hashCode * 397) ^ PageEnd.GetHashCode(); hashCode = (hashCode * 397) ^ Number.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { return(Edition.GetHashCode() ^ ServiceObjective.GetHashCode()); }