Interface IUriFactory
Defines the interface for a factory class that creates URIs and optionally interns them to reduce memory usage from repeated creation of URIs with the same string value.
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public interface IUriFactory
Properties
| Improve this Doc View SourceInternUris
Controls whether URI instances are interned by this instance.
Declaration
bool InternUris { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
When InternUris is set to true, the factory will cache each constructed URI against the original string value used for construction and return a cached Uri where available in preference to calling the Uri constructor.
Methods
| Improve this Doc View SourceClear()
Clears all interned URIs.
Declaration
void Clear()
Create(string)
Create a System.Uri instance, interning it if InternUris is set to true.
Declaration
Uri Create(string uri)
Parameters
Type | Name | Description |
---|---|---|
string | uri | String URI. |
Returns
Type | Description |
---|---|
System.Uri |
Remarks
When URI interning is disabled this is equivalent to just invoking the constructor of the System.Uri class.
Create(Uri, string)
Create a System.Uri instance, interning it if InternUris is set to true.
Declaration
Uri Create(Uri baseUri, string relativeUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | baseUri | The base URI to resolve |
string | relativeUri | String URI. |
Returns
Type | Description |
---|---|
System.Uri |
Remarks
When URI interning is disabled this is equivalent to just invoking the constructor of the System.Uri class.
TryGetUri(string, out Uri)
Return the interned URI instance if available.
Declaration
bool TryGetUri(string uri, out Uri value)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The string URI to return an interned URI instance for. |
System.Uri | value | Receives the interned System.Uri instance if it is available, null otherwise. |
Returns
Type | Description |
---|---|
System.Boolean | True if an interned System.Uri instance was found in this factory or its parent, false otherwise. |