ES2Reader.ReadDictionary

public Dictionary<TKey,TValue> ReadStack<TKey,TValue>(string tag)

Parameters

[table th=”0″]TKey/TValue,”The type of the key/value in the Dictionary we want to load. Must be on the Supported Types list.

tag,”The tag which we want to load.”[/table]

Returns

[table th=”0″]Dictionary<TKey TValue>,”Our loaded data”[/table]

Description

Reads the collection of type T from the ES2Reader with the given tag.

C#

Reading tags from an ES2Reader

using(ES2Reader reader = ES2Reader.Create("myFile.txt"))
{
    // Read data from the file in any order.
    reader.Read<Transform>("transformTag", this.transform); // Self-assigning Read
    this.name = reader.Read<string>("nameTag");
    Dictionary<string,int> myInts = reader.ReadDictionary<string,int>("intsTag");
}

JS

Reading tags from an ES2Reader

var reader : ES2Reader = ES2Reader.Create("myFile.txt"))
// Read data from the file in any order.
reader.Read.<Transform>("transformTag", this.transform); // Self-assigning Read.
this.name = reader.Read.<String>("nameTag");
var myInts = reader.ReadDictionary.<String,int>("intsTag");
// Remember to dispose when we're finished.
reader.Dispose();

public Dictionary<TKey,TValue> ReadDictionary<TKey,TValue>()

Parameters

[table th=”0″]TKey/TValue,”The type of the key/value in the collection we want to load. Must be on the Supported Types list.[/table]

Returns

[table th=”0″]Dictionary<TKey TValue>,”Our loaded data”[/table]

Description

Reads the collection of type T from the ES2Reader. The data must have been saved sequentially using ES2Writer.

C#

Reading data sequentially from an ES2Reader

using(ES2Reader reader = ES2Reader.Create("myFile.txt"))
{
    // Read the data from the file in the same order as we saved it.
    this.name = reader.Read<string>();
    reader.Read<Transform>(this.transform);
    Dictionary<string,int> myInts = reader.ReadDictionary<string,int>();
}

JS

Reading data sequentially from an ES2Reader

var reader : ES2Reader = ES2Reader.Create("myFile.txt"))
// Read the data from the file in the same order as we saved it.
this.name = reader.Read.<String>();
reader.Read.<Transform>(this.transform);
var myInts = reader.ReadDictionary.<String,int>();
// Remember to dispose when we're finished.
reader.Dispose();