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
| Edit this page View SourceInternUris
Controls whether URI instances are interned by this instance.
Declaration
bool InternUris { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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
| Edit this page View SourceClear()
Clears all interned URIs.
Declaration
void Clear()
Create(string)
Create a 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 |
|---|---|
| Uri |
Remarks
When URI interning is disabled this is equivalent to just invoking the constructor of the Uri class.
Create(Uri, string)
Create a Uri instance, interning it if InternUris is set to true.
Declaration
Uri Create(Uri baseUri, string relativeUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | baseUri | The base URI to resolve |
| string | relativeUri | String URI. |
Returns
| Type | Description |
|---|---|
| Uri |
Remarks
When URI interning is disabled this is equivalent to just invoking the constructor of the 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. |
| Uri | value | Receives the interned Uri instance if it is available, null otherwise. |
Returns
| Type | Description |
|---|---|
| bool | True if an interned Uri instance was found in this factory or its parent, false otherwise. |