Enumerations

Enumerations can be loaded just like basic types. For example:

using System;
using Daabli;

namespace ConsoleApplication
{
    // Furious Five Master
    enum Master
    {
        Tigress = 5,
        Viper = 3,
        Monkey = 4,
        Mantis = 1,
        Crane = 2
    };

    class Program
    {
        static void Main(string[] args)
        {
            // Create a Reader and load data from file
            var r = new DefaultReader();
            if (!r.FromFile("input.txt"))
                return;

            Master myMaster = Master.Tigress;

            // Read the enum
            if (!r.Read("myMaster", ref myMaster))
                return;

            // Display the enum
            Console.WriteLine("myMaster: {0}", myMaster);
        }
    }
}

Given the description in input.txt:
myMaster = Monkey;

The output generated would be:
myMaster: Monkey

Next: Containers

Last edited Apr 19, 2012 at 10:27 PM by francisxavier, version 3

Comments

No comments yet.