#
Working with Data
h5 provides seamless integration between standard .NET data types and JavaScript primitives.
#
Primitive Types
Most C# primitive types map directly to JavaScript primitives:
#
Integers & Floating Point
JavaScript uses 64-bit floating point numbers for all numeric types by default. h5 handles integer arithmetic correctly, including overflow/underflow behavior (configurable via overflowMode).
However, for long (64-bit integer), h5 can use BigInt if supported by the target environment, or a custom Long implementation.
#
Arrays
C# arrays are mapped to JavaScript arrays.
int[] numbers = new int[] { 1, 2, 3 };
Becomes:
var numbers = [1, 2, 3];
You can use standard array methods and indexers. However, note that C# arrays are fixed-size, while JavaScript arrays are dynamic. h5 enforces C# semantics where possible.
#
Collections
h5 includes implementations of standard generic collections like List<T>, Dictionary<TKey, TValue>, HashSet<T>, etc.
var list = new List<string> { "a", "b" };
list.Add("c");
var dict = new Dictionary<string, int>();
dict["key"] = 123;
These behave exactly as you expect from .NET, including proper equality comparison for keys in dictionaries.
#
DateTime
System.DateTime is supported and backed by JavaScript's Date object, but provides the full .NET API surface including time zones and formatting.