<div class="meta" robots="noindex">

</div>

Class

# Xojo.Core.MemoryBlock

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `MemoryBlock</api/language/memoryblock>` as a replacement.

</div>

## Description

A read-only class for managing blocks of memory. Since the contents of a MemoryBlock cannot be altered, if you need to alter a MemoryBlock, use `MutableMemoryBlock</api/language/memoryblock>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                               | Type                                                  | Read-Only | Shared |
|----------------------------------------------------|-------------------------------------------------------|-----------|--------|
| `Data<xojo.core.memoryblock.data>`                 | `Ptr</api/data_types/additional_types/ptr>`           | ✓         |        |
| `LittleEndian<xojo.core.memoryblock.littleendian>` | `Boolean</api/data_types/boolean>`                    |           |        |
| `Size<xojo.core.memoryblock.size>`                 | `UInteger</api/data_types/additional_types/uinteger>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                 | Parameters                                                                                                         | Returns                                               | Shared |
|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|--------|
| `BooleanValue<xojo.core.memoryblock.booleanvalue>`   | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Boolean</api/data_types/boolean>`                    |        |
| `Clone<xojo.core.memoryblock.clone>`                 |                                                                                                                    | `MemoryBlock</api/language/memoryblock>`              |        |
| `Comparison<xojo.core.memoryblock.comparison>`       |                                                                                                                    |                                                       |        |
| `Constructor<xojo.core.memoryblock.constructor0>`    | bytes() As `Byte</api/data_types/additional_types/byte>`                                                           |                                                       |        |
| `Constructor<xojo.core.memoryblock.constructor1>`    | other As `MemoryBlock</api/language/memoryblock>`                                                                  |                                                       |        |
| `Constructor<xojo.core.memoryblock.constructor2>`    | p As `Ptr</api/data_types/additional_types/ptr>`                                                                   |                                                       |        |
| `Constructor<xojo.core.memoryblock.constructor3>`    | p As `Ptr</api/data_types/additional_types/ptr>`, size As `UInteger</api/data_types/additional_types/uinteger>`    |                                                       |        |
| `Constructor<xojo.core.memoryblock.constructor4>`    | size As `UInteger</api/data_types/additional_types/uinteger>`                                                      |                                                       |        |
| `CStringValue<xojo.core.memoryblock.cstringvalue>`   | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `CString</api/data_types/additional_types/cstring>`   |        |
| `CurrencyValue<xojo.core.memoryblock.currencyvalue>` | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Currency</api/data_types/currency>`                  |        |
| `DoubleValue<xojo.core.memoryblock.doublevalue>`     | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Double</api/data_types/double>`                      |        |
| `IndexOf<xojo.core.memoryblock.indexof>`             | offset As `UInteger</api/data_types/additional_types/uinteger>`, other As `MemoryBlock</api/language/memoryblock>` | `UInteger</api/data_types/additional_types/uinteger>` |        |
| `Int16Value<xojo.core.memoryblock.int16value>`       | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Int16</api/data_types/additional_types/int16>`       |        |
| `Int32Value<xojo.core.memoryblock.int32value>`       | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Int32</api/data_types/additional_types/int32>`       |        |
| `Int64Value<xojo.core.memoryblock.int64value>`       | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Int64</api/data_types/additional_types/int64>`       |        |
| `Int8Value<xojo.core.memoryblock.int8value>`         | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Int8</api/data_types/additional_types/int8>`         |        |
| `Left<xojo.core.memoryblock.left>`                   | bytes As `UInteger</api/data_types/additional_types/uinteger>`                                                     | `MemoryBlock</api/language/memoryblock>`              |        |
| `PtrValue<xojo.core.memoryblock.ptrvalue>`           | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Ptr</api/data_types/additional_types/ptr>`           |        |
| `Right<xojo.core.memoryblock.right>`                 | bytes As `UInteger</api/data_types/additional_types/uinteger>`                                                     | `MemoryBlock</api/language/memoryblock>`              |        |
| `SingleValue<xojo.core.memoryblock.singlevalue>`     | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `Single</api/data_types/single>`                      |        |
| `UInt16Value<xojo.core.memoryblock.uint16value>`     | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `UInt16</api/data_types/additional_types/uint16>`     |        |
| `UInt32Value<xojo.core.memoryblock.uint32value>`     | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `UInt32</api/data_types/additional_types/uint32>`     |        |
| `UInt64Value<xojo.core.memoryblock.uint64value>`     | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `UInt64</api/data_types/additional_types/uint64>`     |        |
| `UInt8Value<xojo.core.memoryblock.uint8value>`       | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `UInt8</api/data_types/additional_types/uint8>`       |        |
| `WStringValue<xojo.core.memoryblock.wstringvalue>`   | offset As `UInteger</api/data_types/additional_types/uinteger>`                                                    | `WString</api/data_types/additional_types/wstring>`   |        |

## Property descriptions

<div id="xojo.core.memoryblock.data">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Data

**Data** As `Ptr</api/data_types/additional_types/ptr>`

The memory data in the MemoryBlock.

This property is read-only.

This data pointer is invalidated when the MemoryBlock is changed.

<div id="xojo.core.memoryblock.littleendian">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.LittleEndian

**LittleEndian** As `Boolean</api/data_types/boolean>`

When True, indicates that the MemoryBlock data is in LittleEndian format. The default is True.

Simple endian usage:

``` xojo
Var mb1 As New Xojo.Core.MemoryBlock(2) ' defaults to Little Endian = True on all platforms
mb1.Int8Value(0) = 1
mb1.Int8Value(1) = 2

Var firstUInt16 As Int16
firstUInt16 = mb1.UInt16Value(0)
' firstUInt16 = (256 * 2) + (1 * 1) = 513

mb1.LittleEndian = False
Var secondUInt16 As Int16
secondUInt16 = mb1.UInt16Value(0)
' secondUInt16 = (256 * 1) + (1 * 2) = 258
```

<div id="xojo.core.memoryblock.size">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Size

**Size** As `UInteger</api/data_types/additional_types/uinteger>`

The size (in bytes) of the MemoryBlock.

This property is read-only.

If the size is unknown, this returns &hFFFFFFFF (32-bit apps) or &hFFFFFFFFFFFFFFFF (64-bit app).

## Method descriptions

<div id="xojo.core.memoryblock.booleanvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.BooleanValue

**BooleanValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Boolean</api/data_types/boolean>`

Gets a Boolean value at the specified offset (in bytes). Any non-zero value is considered True.

<div id="xojo.core.memoryblock.clone">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Clone

**Clone** As `MemoryBlock</api/language/memoryblock>`

Makes a copy of the MemoryBlock. If its size is known, it copies the content.

``` xojo
Var mb1 As New Xojo.Core.MemoryBlock(64)
Var mb2 As Xojo.Core.MemoryBlock = mb1.Clone
```

<div id="xojo.core.memoryblock.comparison">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Comparison

**Comparison**

MemoryBlocks can be compared with each other using the "=" operator.

MemoryBlocks are considered equal for these conditions: \* The MemoryBlocks are the same object \* Both MemoryBlocks' data point to the same location \* Both MemoryBlocks' size and content are the same There is no concept of one MemoryBlock being greater than or less than another MemoryBlock.

<div id="xojo.core.memoryblock.constructor0">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Constructor

**Constructor**(bytes() As `Byte</api/data_types/additional_types/byte>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a MemoryBlock from an existing Byte array.

<div id="xojo.core.memoryblock.constructor1">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Constructor

**Constructor**(other As `MemoryBlock</api/language/memoryblock>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a new MemoryBlock with the data from an existing MemoryBlock.

<div id="xojo.core.memoryblock.constructor2">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Constructor

**Constructor**(p As `Ptr</api/data_types/additional_types/ptr>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a MemoryBlock from an existing chunk of memory.

<div id="xojo.core.memoryblock.constructor3">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Constructor

**Constructor**(p As `Ptr</api/data_types/additional_types/ptr>`, size As `UInteger</api/data_types/additional_types/uinteger>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a MemoryBlock from an existing block of memory of a specific size.

<div id="xojo.core.memoryblock.constructor4">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Constructor

**Constructor**(size As `UInteger</api/data_types/additional_types/uinteger>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a MemoryBlock with the desired size in bytes.

Reserve 1K:

``` xojo
Var mb As New Xojo.Core.MemoryBlock(1024) ' Reserve 1K bytes
```

<div id="xojo.core.memoryblock.cstringvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.CStringValue

**CStringValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `CString</api/data_types/additional_types/cstring>`

Gets a CString value at the specified offset (in bytes).

A CString is a sequence of non-zero bytes followed by a terminating Chr(0) to mark the end of the CString.

<div id="xojo.core.memoryblock.currencyvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.CurrencyValue

**CurrencyValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Currency</api/data_types/currency>`

Gets an 8-byte Currency value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.doublevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.DoubleValue

**DoubleValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Double</api/data_types/double>`

Gets a Double value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.indexof">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.IndexOf

**IndexOf**(offset As `UInteger</api/data_types/additional_types/uinteger>`, other As `MemoryBlock</api/language/memoryblock>`) As `UInteger</api/data_types/additional_types/uinteger>`

Returns the position of the other MemoryBlock starting at the offset. Returns -1 if other was not found.

<div id="xojo.core.memoryblock.int16value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Int16Value

**Int16Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Int16</api/data_types/additional_types/int16>`

Gets an Int16 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.int32value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Int32Value

**Int32Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Int32</api/data_types/additional_types/int32>`

Gets an Int32 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.int64value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Int64Value

**Int64Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Int64</api/data_types/additional_types/int64>`

Gets an Int64 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.int8value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Int8Value

**Int8Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Int8</api/data_types/additional_types/int8>`

Gets an Int8 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Left

**Left**(bytes As `UInteger</api/data_types/additional_types/uinteger>`) As `MemoryBlock</api/language/memoryblock>`

Gets the specified number of bytes at the beginning of the MemoryBlock.

<div id="xojo.core.memoryblock.ptrvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.PtrValue

**PtrValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Ptr</api/data_types/additional_types/ptr>`

Gets a Ptr value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.right">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.Right

**Right**(bytes As `UInteger</api/data_types/additional_types/uinteger>`) As `MemoryBlock</api/language/memoryblock>`

Gets the bytes from the end of the MemoryBlock.

Get the last two bytes of a MemoryBlock:

``` xojo
Var bytes() As Byte
bytes.Append(&h0a)
bytes.Append(&h0b)
bytes.Append(&h0c)

Var data As New Xojo.Core.MemoryBlock(bytes)
Var mb As Xojo.Core.MemoryBlock = data.Right(2)
```

<div id="xojo.core.memoryblock.singlevalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.SingleValue

**SingleValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `Single</api/data_types/single>`

Gets a Single value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.uint16value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.UInt16Value

**UInt16Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `UInt16</api/data_types/additional_types/uint16>`

Gets an UInt16 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.uint32value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.UInt32Value

**UInt32Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `UInt32</api/data_types/additional_types/uint32>`

Gets an UInt32 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.uint64value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.UInt64Value

**UInt64Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `UInt64</api/data_types/additional_types/uint64>`

Gets an UInt64 value at the specified offset (in bytes).

<div id="xojo.core.memoryblock.uint8value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.UInt8Value

**UInt8Value**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `UInt8</api/data_types/additional_types/uint8>`

Gets an UInt8 value at the specified offset (in bytes). A UInt8 can also be considered a Byte.

Get the bytes from a MemoryBlock:

``` xojo
Var getBytes() As UInt8
For i As Integer = 0 To 3
  getBytes.AddRow(mb.UInt8Value(i))
Next
```

<div id="xojo.core.memoryblock.wstringvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Xojo.Core.MemoryBlock.WStringValue

**WStringValue**(offset As `UInteger</api/data_types/additional_types/uinteger>`) As `WString</api/data_types/additional_types/wstring>`

Gets a WString value at the specified offset (in bytes).

## Notes

For 32-bit apps, you can request a maximum of about 2 to 3 GB depending on the OS. Generally Windows is closer to 2GB and macOS/Linux are closer to 3GB. There is no practical limit for 64-bit apps.

To convert Text to a MemoryBlock, use TextEncoding.ConvertTextToData. To convert a MemoryBlock to Text, use TextEncoding.ConvertDataToText.

Compared to MutableMemoryBlock, MemoryBlock is more efficient in terms of memory use savings, but doesn't really have any difference in terms of access. Being able to pass around immutable chunks of data allows the framework to directly reference internal data and avoid having to copy it on the off chance it might get modified.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Decodehex

To convert a hex Text to a MemoryBlock you can use code like this:

``` xojo
' hex contains hex as Text
Var bytes() As UInt8
For i As Integer = 0 To hex.Length - 2 Step 2
  Var value As UInt8 = UInt8.FromHex(hex.Mid(i, 2))
  bytes.AddRow(value)
Next
Var mb As New Xojo.Core.MemoryBlock(bytes)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Encodehex

To EncodeHex the contents of a MemoryBlock you can use code like this:

``` xojo
Var joiner() As Text
For i As Integer = 0 To hashMB.Size - 1
  Var b As UInt8 = hashMB.UInt8Value(i)
  joiner.AddRow(b.ToHex(2))
Next
Var hex As Text = Text.Join(joiner, "")
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Converting to a classic memoryblock

When using both the Classic and New Framework in a single (desktop, web or console) app, you may find that you need to convert a <span class="title-ref">Xojo.Core.MemoryBlock</span> to a Classic MemoryBlock for use with other methods. You can do so by copying the data from the <span class="title-ref">Xojo.Core.MemoryBlock</span> to the Classic MemoryBlock:

``` xojo
' newMB is a Xojo.Core.MemoryBlock
Var temp As MemoryBlock = newMb.Data
Var mb As New MemoryBlock(newMb.Size)
mb.StringValue(0, mb.Size) = temp.StringValue(0, mb.Size)
temp = Nil ' optional as it will also be cleared when it goes out of scope
```

## Compatibility

All project types on all supported operating systems.

## See also

`Object</api/data_types/additional_types/object>` parent class; `MemoryBlock</api/language/memoryblock>`, `MemoryBlock</api/language/memoryblock>` classes
