Reply To: Brick-Simulator?

HomeForumsMonoBrick EV3 FirmwareBrick-Simulator?Reply To: Brick-Simulator?

Author Image
Martin Wagner

Hi Anders,
sorry, the singleton implementation is DotNet4 stuff and I don’t know whether it runs in Mono.

#region SingletonStuff
// ensures that only one instance of this class can exist, so everybody writes and reads the same variables
private ButtonHAL() { } // hiding creator

// static holder for instance, need to use lambda to construct since constructor private (DotNet4 only)
private static readonly Lazy<ButtonHAL> _instance = new Lazy<ButtonHAL>(() => new ButtonHAL());

// accessor for instance
public static ButtonHAL GetSingleton { get { return _instance.Value; } }
#endregion //SingletonStuff

Can one of the mono experts have a look at it?


Posted in

Make a donation