How to get the default value of a struct, why this code does not work?
KeyValuePair<DateTimeOffset, Alarm> kvpAlarmDuplicate = lastestUniqueAlarms.FirstOrDefault(kvp => kvp.Value.OriginalUniqueMessage == originalUniqueMsg);
if (kvpAlarmDuplicate == default(KeyValuePair<DateTimeOffset, Alarm>)) // Here error*
{
...
}
Error* => CS0019 Operator '==' cannot be applied to operands of type
'KeyValuePair<DateTimeOffset, Alarm>' and
'KeyValuePair<DateTimeOffset, Alarm>'
How to know if the returned value is the default one?
Additional info (I don't know if it is useful, just in case)? =>
[Table("alarm")]
public class Alarm
{
public Alarm()
{
}
public static TimeSpan DelayDuplicateOccurence { get; set; } = TimeSpan.FromMinutes(10);
public int AlarmId { get; set; }
...