119 archive.
SetInt64Array(key, Array.ConvertAll(ia, x => (
long)x));
127 archive.
SetDoubleArray(key, Array.ConvertAll(fa, x => (
double)x));
136 $
"Value type '{value.GetType().FullName}' is not supported."
173 if (t == typeof(
bool))
175 return (T)(object)archive.
GetBool(key);
179 if (t == typeof(
int))
181 return (T)(object)checked((
int)archive.
GetInt64(key));
184 if (t == typeof(
long))
186 return (T)(object)archive.
GetInt64(key);
189 if (t == typeof(
float))
191 return (T)(object)checked((
float)archive.
GetDouble(key));
194 if (t == typeof(
double))
196 return (T)(object)archive.
GetDouble(key);
199 if (t == typeof(
string))
201 return (T)(object)archive.
GetString(key);
209 if (t == typeof(
bool[]))
214 if (t == typeof(
long[]))
219 if (t == typeof(
double[]))
224 if (t == typeof(
string[]))
230 $
"Type '{t.FullName}' is not supported."
Exception thrown when an invalid parameter is detected.
Exception thrown when an operation is not supported.
Provides convenience extension methods for setting and retrieving values from an IArchive using commo...
static T GetValue< T >(this IArchive archive, string key)
Retrieves a value from the archive and converts it to the requested CLR type.
static void SetValue(this IArchive archive, string key, object value)
Stores a value in the archive using runtime type dispatch.
Represents a hierarchical, strongly-typed key-value archive.
IArchive GetArchive(string key)
Retrieves a nested archive by key.
void SetBoolArray(string key, IEnumerable< bool > value)
Stores an array of boolean values under the specified key.
double GetDouble(string key)
Retrieves a double-precision floating-point value by key.
void SetBool(string key, bool value)
Stores a boolean value under the specified key.
IReadOnlyList< string > GetStringArray(string key)
Retrieves an array of string values by key.
long GetInt64(string key)
Retrieves a 64-bit integer value by key.
void SetStringArray(string key, IEnumerable< string > value)
Stores an array of string values under the specified key.
IReadOnlyList< long > GetInt64Array(string key)
Retrieves an array of 64-bit integer values by key.
void SetArchive(string key, IArchive value)
Stores a nested archive under the specified key.
void SetInt64(string key, long value)
Stores a 64-bit integer value under the specified key.
bool GetBool(string key)
Retrieves a boolean value by key.
IReadOnlyList< double > GetDoubleArray(string key)
Retrieves an array of double-precision floating-point values by key.
void SetInt64Array(string key, IEnumerable< long > value)
Stores an array of 64-bit integer values under the specified key.
void SetDouble(string key, double value)
Stores a double-precision floating-point value under the specified key.
string GetString(string key)
Retrieves a string value by key.
void SetDoubleArray(string key, IEnumerable< double > value)
Stores an array of double-precision floating-point values under the specified key.
void SetString(string key, string value)
Stores a string value under the specified key.
IReadOnlyList< bool > GetBoolArray(string key)
Retrieves an array of boolean values by key.