Class ProtocolRelativeUriStringOptions
Configuration options for concrete implementations of IConfigurableParser<TOptions> that is related to parsing a protocol relative URI from a string.
public class ProtocolRelativeUriStringOptions : IParameterObject
- Inheritance
-
ProtocolRelativeUriStringOptions
- Implements
Examples
The following example demonstrates how to configure ProtocolRelativeUriStringOptions to resolve protocol-relative URIs (such as //example.com/resource) by specifying the default protocol scheme.
using System;
using Cuemon;
using Cuemon.Text;
namespace MyApp.Examples
{
public class ProtocolRelativeUriStringOptionsExample
{
public void Demonstrate()
{
// Configure how a protocol-relative URI (e.g., "//example.com/resource")
// is resolved to an absolute URI by specifying the default protocol.
var options = new ProtocolRelativeUriStringOptions
{
Protocol = UriScheme.Https,
RelativeReference = Alphanumeric.NetworkPathReference
};
Console.WriteLine($"Protocol: {options.Protocol}");
Console.WriteLine($"Relative reference: {options.RelativeReference}");
// Switch to HTTP for local development
options.Protocol = UriScheme.Http;
Console.WriteLine($"Updated protocol: {options.Protocol}");
}}
}
Constructors
ProtocolRelativeUriStringOptions()
Initializes a new instance of the ProtocolRelativeUriStringOptions class.
public ProtocolRelativeUriStringOptions()
Remarks
The following table shows the initial property values for an instance of ProtocolRelativeUriStringOptions.
| Property | Initial Value |
|---|---|
| Protocol | Https |
| RelativeReference | NetworkPathReference |
Properties
Protocol
Gets or sets the protocol to replace the relative reference.
public UriScheme Protocol { get; set; }
Property Value
- UriScheme
The protocol to replace the relative reference.
RelativeReference
Gets or sets the protocol relative reference that needs to be replaced.
public string RelativeReference { get; set; }
Property Value
- string
The protocol relative reference that needs to be replaced.
Exceptions
- ArgumentNullException
valuecannot be null.- ArgumentException
valuecannot be empty or consist only of white-space characters.