Created
November 27, 2019 13:30
-
-
Save pizycki/33d0c9791356040cee970227a8d348ce to your computer and use it in GitHub Desktop.
Generic IOptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GenericOptions<T> : IOptions<T> where T : class, new() | |
| { | |
| public GenericOptions(T value) | |
| { | |
| Value = value ?? throw new ArgumentNullException(nameof(value)); | |
| } | |
| public T Value { get; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type GenericOptions<'T when 'T : (new : unit -> 'T) and 'T : not struct>(value:'T) = | |
| interface IOptions<'T> with | |
| member x.Value = value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment