|
||
|
|||||||
| FAQ Forum A place to find answers to the most frequently asked questions, and a place to post said answers. Do NOT use this forum to ask questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
|
Problem scope
Serialize a System.Collections.Generic.List<T> object CASE I - T is Mobile, Item or Guild The RunUO core serialize methods supports those lists: List<Mobile> yourMobilesList = reader.ReadStrongMobileList(); writer.WriteMobileList(yourMobilesList); CASE II - T is another type First, you've to get a simple serializable type from T, like a string, a number or an enum. Serialize code We serialize first the number of items in the list, then each list item. PHP Code:
We first deserialize the number of items, create a new list and add to it each item we deserialize. PHP Code:
Here a class RunicItem who allow to define runes for an item. Each rune (identified by an RuneType enum) is put in the runes list. PHP Code:
__________________
La connaissance s'accroît quand on la partage. Share your knowledge, you'll increase it. Utopia. Votre Monde. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| deserialize, list, serialize |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|