/// <summary> /// Initializes a new instance of the <see cref="YamlConfigurationSource"/> class. /// </summary> /// <param name="src">The source.</param> public YamlConfigurationSource(Stream src) { if (src == null) { throw new ArgumentNullException(nameof(src)); } if (!src.CanRead) { throw new IOException("Cannot read content from the provided stream"); } source = YamlSource.Stream; stream = src; streamPosition = src.Position; sync = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
/// <summary> /// Initializes a new instance of the <see cref="YamlConfigurationSource"/> class. /// </summary> /// <param name="filename">The full path to the document.</param> public YamlConfigurationSource(string filename) { path = new FileInfo(filename ?? throw new ArgumentNullException(nameof(filename))); source = YamlSource.File; sync = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
/// <summary> /// Initializes a new instance of the <see cref="YamlConfigurationSource"/> class. /// </summary> /// <param name="doc">The document.</param> public YamlConfigurationSource(YamlDocument doc) { document = doc ?? throw new ArgumentNullException(nameof(doc)); source = YamlSource.Document; sync = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }