Struct ResourceEntry
Represents resource entry.
Inherited Members
Namespace: DotNext.Resources
Assembly: DotNext.dll
Syntax
public readonly struct ResourceEntry
Properties
View SourceManager
Gets resource manager providing access to the entry.
Declaration
public ResourceManager Manager { get; }
Property Value
| Type | Description |
|---|---|
| ResourceManager |
Name
Gets name of the resource entry.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceAsStream(CultureInfo?)
Returns resource entry as a stream.
Declaration
public Stream AsStream(CultureInfo? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | An object that represents the culture for which the resource is localized. |
Returns
| Type | Description |
|---|---|
| Stream | The stream representing resource entry. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The value of the specified resource is not Stream. |
| MissingManifestResourceException | No usable set of resources has been found, and there are no resources for the default culture. |
| MissingSatelliteAssemblyException | The default culture's resources reside in a satellite assembly that could not be found. |
AsString(CultureInfo?)
Returns resource string.
Declaration
public string AsString(CultureInfo? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | An object that represents the culture for which the resource is localized. |
Returns
| Type | Description |
|---|---|
| string | The resource string. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The value of the specified resource is not a string. |
| MissingManifestResourceException | No usable set of resources has been found, and there are no resources for the default culture. |
| MissingSatelliteAssemblyException | The default culture's resources reside in a satellite assembly that could not be found. |
As<T>(CultureInfo?)
Deserializes resource entry.
Declaration
public T As<T>(CultureInfo? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CultureInfo | culture | An object that represents the culture for which the resource is localized. |
Returns
| Type | Description |
|---|---|
| T | The deserialized resource entry. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the resource entry. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The resource entry is not of type |
| MissingManifestResourceException | No usable set of resources has been found, and there are no resources for the default culture. |
| MissingSatelliteAssemblyException | The default culture's resources reside in a satellite assembly that could not be found. |
Format(params object?[])
Returns formatted resource string.
Declaration
public string Format(params object?[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | args | The formatting arguments. |
Returns
| Type | Description |
|---|---|
| string | The formatter resource string. |
Operators
View Sourceexplicit operator Stream(in ResourceEntry)
Obtains resource entry as a stream.
Declaration
public static explicit operator Stream(in ResourceEntry entry)
Parameters
| Type | Name | Description |
|---|---|---|
| ResourceEntry | entry | The resource entry. |
Returns
| Type | Description |
|---|---|
| Stream | The stream representing resource entry. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The value of the specified resource is not a string. |
| MissingManifestResourceException | No usable set of resources has been found, and there are no resources for the default culture. |
| MissingSatelliteAssemblyException | The default culture's resources reside in a satellite assembly that could not be found. |
explicit operator string(in ResourceEntry)
Obtains resource string.
Declaration
public static explicit operator string(in ResourceEntry entry)
Parameters
| Type | Name | Description |
|---|---|---|
| ResourceEntry | entry | The resource entry. |
Returns
| Type | Description |
|---|---|
| string |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The value of the specified resource is not a string. |
| MissingManifestResourceException | No usable set of resources has been found, and there are no resources for the default culture. |
| MissingSatelliteAssemblyException | The default culture's resources reside in a satellite assembly that could not be found. |