Last modified: 2024-09-14
Storage.Get Method
Returns a value from the persistent store based on the given key.
Namespace: Neo.SmartContract.Framework.Services
Assembly: Neo.SmartContract.Framework
Syntax
public static extern byte[] Get(StorageContext context, byte[] key);
public static extern byte[] Get(StorageContext context, ByteString key);
Parameters:
Context: Storage context as a StorageContext .
Key: Key as a byte array or string. Max length 64 bytes.
Return Value: The value corresponding to the key as a byte array.
Example
public class Contract1 : SmartContract.Framework.SmartContract
{
public static void Main()
{
byte[] value = Storage.Get(Storage.CurrentContext, new byte[] { 0 });
byte[] value = Storage.Get(Storage.CurrentContext, "aa");
}
}