| title | Addendum: Variable Limitations for NEO Contracts | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| actions |
|
||||||||
| material |
|
Because NEO Virtual Machine is more compact than .Net, NEO's C# compiler only supports a limited number of variables from C#. Considering the large scope of features in C#, it is helpful to take a white-list approach, and look at the basic types that are fully supported by the compiler:
- ByteArray
- Integer
- Boolean
- Array
- Struct
- Map
- Interface
Some other commonly used types are implemented through one of the above types, for example:
- All integral types (
int,uint,ulong, ...) are implemented asBigIntegerfromSystem.Numerics, and are fully supported stringis implemented in NEO VM as its UTF8 ByteArray, which means it does not support the string handlers native to .Netcharis implemented as integer
See this page for a detailed account on supported types and limitations.
The NEO library also has a few built-in types to address the lack of a some C# types.
-
BigDecimal is a custom struct that can be used to define a decimal number. It can be used in place of float point numbers.
-
Map is a custom class used for key-value dictionaries.