Class EmbeddedFileUtility
Provides embedded file utilities.
Inheritance
Inherited Members
Namespace: Celerik.NetCore.Util
Assembly: cs.temp.dll.dll
Syntax
public static class EmbeddedFileUtility
Methods
ReadFile(String, Assembly)
Reads the content of an embedded file existing into the specified assembly.
Declaration
public static string ReadFile(string fileName, Assembly assembly = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | The case-sensitive name of the manifest resource being requested without including the assembly namespace. E.g.: "FolderName.FileName.extension". |
| Assembly | assembly | The assembly where we get the resource. If null, we search the resource into the calling assembly. |
Returns
| Type | Description |
|---|---|
| System.String | Content of the embedded file existing into the specified assembly. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullOrEmptyException | The fileName is null or empty. |
ReadJson<TOutputType>(String, Assembly, Boolean)
Reads the content of an embedded JSON file into the specified output type.
Declaration
public static TOutputType ReadJson<TOutputType>(string fileName, Assembly assembly = null, bool serializeAll = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | The case-sensitive name of the manifest resource being requested without including the assembly namespace. E.g.: "FolderName.FileName.json". |
| Assembly | assembly | The assembly where we get the resource. If null, we search the resource into the calling assembly. |
| System.Boolean | serializeAll | Indicates whether all props should be serialized without taking into account the JsonIgnore attribute. |
Returns
| Type | Description |
|---|---|
| TOutputType | Content of the embedded JSON file loaded into the specified Type. |
Type Parameters
| Name | Description |
|---|---|
| TOutputType | The type to which the JSON file will be loaded. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullOrEmptyException | The fileName is null or empty. |