uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

ValueByte(Byte)

Method

Product: 

Fast Math Parser

Class: 

Item

Sets the value of an Item that represents an 8-bit integer (byte) variable.

Syntax

ValueByte(Byte)

Parameters

value
Byte
The 8-bit integer (byte) value to assign to the variable.

Return

void

This method does not return a value.

Remarks

This method provides a type-safe way to assign a value to a uCalc Item that has been defined as an 8-bit integer, such as Int8 or Byte (BuiltInType::Integer_8u). It is the counterpart to the getter version of ValueByte().

It is more efficient than using the generic Value(string) overload, as it avoids the overhead of parsing and evaluating a string.

Comparative Analysis

  • vs. Native C#/C++: In native code, you would assign a value directly (e.g., myByte = 255;). uCalc's ValueByte method provides a consistent API for dynamically manipulating the engine's internal variables at runtime, either by the Item handle or through its name. This allows the host application to interact with the uCalc state in a structured, type-safe manner without needing to bind variables directly to memory addresses.

  • vs. Item.Value(string): The generic string-based setter is more flexible but less performant. It must parse and evaluate the input string before converting it to the target type. ValueByte is a direct, type-safe assignment that bypasses this process, making it ideal for performance-critical updates.

Use DefineVariable to create the variable before setting its value.

Examples