ES3.Load

public static T Load<T>(string key, string filePath, T defaultValue, ES3Settings settings)

Description

Loads the value from a file with the given key.

Unless you specify the defaultValue parameter, a KeyNotFoundException or FileNotFoundException will be thrown if the data does not exist. In this case, you can use ES3.KeyExists or ES3.FileExists to check if the data exists before loading.

Parameters

T The type of the data we wish to load. Can be an inherited type.

key

The unique key which identifies the data we're loading.

filePath

[Optional] The relative or absolute path of the file we want to load from.

defaultValue

[Optional] The value we want to return if the file or key does not exist.

settings

[Optional] The settings we want to use to override the default settings.

Returns

The loaded data of type T, or the default value if using the default value parameter and there is no data to load.

Examples

C#

JS