An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Here is how to use a private constructor.
public sealed class Singleton
{
private static readonly Lazy<Singleton> Lazy = new(() => new Singleton());
public static Singleton Instance => Lazy.Value;
public DateTime DateTime { get; set; }
private Singleton()
{
DateTime = DateTime.Now;
}
}
Then to call Singleton.Instance.DateTime the constructor is only called the first time.