Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Main()
- {
- //CultureInfo.GetCultures( CultureTypes.InstalledWin32Cultures).Dump();
- var culture = CultureInfo.GetCultureInfo("ar-MA");
- var data = new List<Hotel>()
- {
- new Hotel() {Name= "1", HotelCity = "A".GetHashCode().ToString(culture)},
- new Hotel() {Name= "2", HotelCity = "A".GetHashCode().ToString(culture)},
- new Hotel() {Name= "3", HotelCity = "B".GetHashCode().ToString(culture)},
- new Hotel() {Name= "4", HotelCity = "C".GetHashCode().ToString(culture)},
- new Hotel() {Name= "5", HotelCity = "B".GetHashCode().ToString(culture)}
- };
- Console.WriteLine("Data:");
- data.ForEach(d => Console.WriteLine($"{d.Name}: {d.HotelCity}"));
- var hotels = data.Select(d => d);
- var city = "B".GetHashCode().ToString(CultureInfo.InvariantCulture);
- Console.WriteLine();
- Console.WriteLine("Matches:");
- hotels = hotels.Where(h => h.HotelCity == city);
- hotels.ToList().ForEach(d => Console.WriteLine($"{d.Name}: {d.HotelCity}"));
- }
- class Hotel
- {
- public string Name { get; set; }
- public string HotelCity { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment