What does the “private” modifier do?

There’s a certain amount of misinformation here: “The default access modifier is not private but internal” Well, that depends on what you’re talking about. For members of a type, it’s private. For top-level types themselves, it’s internal. “Private is only the default for methods on a type” No, it’s the default for all members of … Read more

Strip seconds from datetime

You can create a new instance of date with the seconds set to 0. DateTime a = DateTime.UtcNow; DateTime b = new DateTime(a.Year, a.Month, a.Day, a.Hour, a.Minute, 0, a.Kind); Console.WriteLine(a); Console.WriteLine(b);