using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Security.Cryptography;
public static void Main()
var timeZones = GetTimeZones();
foreach (var tz in timeZones)
Console.WriteLine(string.Format("{0} => {1}", tz.DisplayName, tz.StandardName));
for (int i = 1; i < 13; i++)
var dates = GetDates(2018, i);
Console.WriteLine(String.Format("{0:y}", dates.First().Date));
dates.ForEach(d => Console.WriteLine(String.Format("{0:D}", d.Date)));
var variable1 = "10d1e5bc4f55c05050f4ae697d0703f7d63af0a4";
string inputString = "SomePassword";
var variable2 = Hash(inputString);
if (variable1.Equals(variable2))
Console.WriteLine("Password stored in DB is equals to the password entered from the input");
List<Dog> dogs = new List<Dog>();
dogs.Add(new Dog("Fido"));
dogs.Add(new Dog("Bob"));
dogs.Add(new Dog("Adam"));
foreach (Dog dog in dogs)
Console.WriteLine(dog.Describe());
Console.WriteLine(dogs[0].CompareTo(dogs[2]));
Console.WriteLine(dogs[1].CompareTo(dogs[2]));
foreach (var prop in typeof(Course).GetProperties())
Console.WriteLine("{0}", prop.Name);
var course = new Course {Id =1 , Name = "Software", Term = "Something", Level = 1 };
foreach (var prop in course.GetType().GetProperties())
Console.WriteLine("{0} = {1}", prop.Name, prop.GetValue(course, null));
List<Course> courses = new List<Course>();
courses.Add(new Course() { Id = 1, Name = "Maths", Level = 1 });
courses.Add(new Course() { Id = 2, Name = "Science", Level = 1 });
courses.Add(new Course() { Id = 3, Name = "Physics", Level = 2 });
var firstCourse = courses.OrderBy(c =>c.Id).First();
Console.WriteLine("The first course is {0}", firstCourse.Name);
var level1List = courses.Where(c => c.Level == 1).ToList();
Console.WriteLine("The courses of level 1 are");
level1List.ForEach(c => Console.WriteLine(c.Name));
var client = new RestClient("https://www.metaweather.com");
var request = new RestRequest("/api/location/search/?query=san", Method.GET);
IRestResponse response = client.Execute(request);
var content = response.Content;
Console.WriteLine(content);
static ReadOnlyCollection<TimeZoneInfo> GetTimeZones()
ReadOnlyCollection<TimeZoneInfo> tz;
tz = TimeZoneInfo.GetSystemTimeZones();
public static List<DateTime> GetDates(int year, int month)
return Enumerable.Range(1, DateTime.DaysInMonth(year, month))
.Select(day => new DateTime(year, month, day))
public static string Hash(string password)
var hash = (new SHA1Managed()).ComputeHash(Encoding.UTF8.GetBytes(password));
return string.Join("", hash.Select(b => b.ToString("x2")).ToArray());
class Dog : IAnimal, IComparable<Dog>
return string.Format("Description of the dog {0}, he is black and strong,...", _name);
public int CompareTo(Dog dog)
if (this._name.Equals(dog.Name)) return 0;
public int Id { get; set; }
public string Name { get; set; }
public string Term { get; set; }
public int Level { get; set; }