AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="0.9.9.1" />

 CreateDocumentOptions

public sealed class CreateDocumentOptions
Data transport class to abstract common options in document creation.
using AngleSharp.Dom; using AngleSharp.Extensions; using AngleSharp.Html; using AngleSharp.Network; namespace AngleSharp { public sealed class CreateDocumentOptions { private readonly IResponse _response; private readonly MimeType _contentType; private readonly TextSource _source; private readonly IDocument _ancestor; public IResponse Response => _response; public MimeType ContentType => _contentType; public TextSource Source => _source; public IDocument ImportAncestor => _ancestor; public CreateDocumentOptions(IResponse response, IConfiguration configuration, IDocument ancestor = null) { MimeType contentType = response.GetContentType(MimeTypeNames.Html); string parameter = contentType.GetParameter(AttributeNames.Charset); TextSource textSource = new TextSource(response.Content, configuration.DefaultEncoding()); if (!string.IsNullOrEmpty(parameter) && TextEncoding.IsSupported(parameter)) textSource.CurrentEncoding = TextEncoding.Resolve(parameter); _source = textSource; _contentType = contentType; _response = response; _ancestor = ancestor; } } }