Exemplo n.º 1
0
 public static T ReadRequired <T>(this TwinCollection twinCollection, string property, ILogger?logger = null) =>
 twinCollection.TryRead(property, logger, out T? result)
         ? result
         : throw new InvalidOperationException($"Property '{property}' does not exist or is invalid.");
Exemplo n.º 2
0
 public static T?SafeRead <T>(this TwinCollection twinCollection, string property, T?defaultValue = default, ILogger?logger = null)
 => twinCollection.TryRead <T>(property, logger, out var someT) ? someT : defaultValue;