Tries to convert itself to a Sofu.List.
Declaration Syntax
C# |
public virtual List AsList()
Return Value
Returns itself. But you can be sure it is a List
Examples
CopyC#
Sofu.Sofu.Map file = SofuReader.LoadFile("file.sofu"); foreach (KeyValuePair<string,Sofu.SofuObject> entry in file) { if (entry.Value.IsList()) { foreach (SofuObject e in e.Value.AsList()) { // You don't need to catch exceptions here, IsList() makes sure it is a List. if (e.IsValue()) Console.WriteLine(e.AsValue().ToString()); } } }
Exceptions
Exception | Condition |
---|---|
SofuNotListException | Gets thrown if the Object is not a List |