Trigger/Runtime/ITriggerExtensions.cs

15 lines
759 B
C#
Raw Normal View History

namespace Syntriax.Modules.Trigger
{
public static class ITriggerExtensions
{
/// <summary>
/// Checks if the provided parameter <see cref="ITrigger"/> is toggled, if the parameter is null returns the nullValue parameter
/// </summary>
/// <param name="trigger"><see cref="ITrigger"/> to be checked if toggled or not</param>
/// <param name="nullValue">The value that will be returned if trigger is null. Default value: true</param>
/// <returns><see cref="ITrigger"/>'s toggle value, or if null return nullValue parameter</returns>
public static bool IsTriggeredNullChecked(this ITrigger trigger, bool nullValue = true)
=> trigger == null ? nullValue : trigger.IsTrigerred;
}
}