Static Public Member Functions | |
| static void | SetValue (this IArchive archive, string key, object value) |
| Stores a value in the archive using runtime type dispatch. | |
| static T | GetValue< T > (this IArchive archive, string key) |
| Retrieves a value from the archive and converts it to the requested CLR type. | |
Provides convenience extension methods for setting and retrieving values from an IArchive using common CLR types.
These methods are intended as syntactic sugar over the strongly-typed IArchive API. They do not replace the explicit Set/Get methods and should primarily be used at call sites where reduced verbosity is desired.
Supported CLR types are intentionally limited to ensure predictable, cross-language behavior compatible with the C++ archive representation.
Type mapping rules:
Unsupported CLR types are not handled by these helpers unless explicitly documented.
All archive contract rules still apply: missing keys, type mismatches, or unsupported conversions will result in exceptions.
|
inlinestatic |
Retrieves a value from the archive and converts it to the requested CLR type.
| T | The expected CLR type of the value. |
| archive | The source archive. |
| key | The key identifying the stored value. |
| CommonInvalidParameterException | Thrown if archive is null. |
| CommonNotSupportedException | Thrown if T is not supported by this helper method. |
| Exception | Thrown by the underlying IArchive implementation if the key does not exist or the stored value has an incompatible type. |
Only a limited set of CLR types is supported. Numeric conversions are restricted to safe, explicit mappings defined by the archive contract.
This method does not perform implicit narrowing conversions.
|
inlinestatic |
Stores a value in the archive using runtime type dispatch.
| archive | The target archive. |
| key | The key under which the value will be stored. |
| value | The value to store. Must not be null. |
| CommonInvalidParameterException | Thrown if archive or value is null. |
| CommonNotSupportedException | Thrown if the runtime type of value is not supported. |
The runtime type of value determines which IArchive setter is invoked. If a value already exists under the specified key, it is overwritten.
This method performs widening numeric conversions only (e.g. int → long, float → double).