This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
var data1 = new Data("data1"); | |
var data2 = new Data("data2"); | |
Console.WriteLine(new DataEqualityComparer().Equals(data1, data2)); | |
public record Data(string SomeProp); | |
public class DataEqualityComparer : IEqualityComparer<Data> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Time: | |
"""Represents and manipulates hours and minutes""" | |
def __init__(self, hour=12, minute=0): | |
valid_hour, valid_minute = Time.make_valid(hour, minute) | |
self.__hour = valid_hour | |
self.__minute = valid_minute | |
def __str__(self): | |
return "{0}:{1:02}".format(self.__hour, self.__minute) |