Add() public method

Adds a value to the enum which follows the last value added. If no values are in the enum, its value will be 0.
public Add ( string name ) : EnumValue
name string The name of the value.
return EnumValue
Esempio n. 1
0
        private void ReadBits(XmlReader reader, string name, BasicFieldType type)
        {
            XmlReader subtree = reader.ReadSubtree();

            var enumLayout = new EnumLayout(name, type);

            subtree.ReadStartElement();
            enumLayout.Add(new EnumValue("None", 0));
            while (subtree.ReadToNextSibling("bit"))
            {
                enumLayout.Add(ReadBit(subtree));
            }

            _results.Layout.Add(new EnumTagLayoutField(name, enumLayout));
        }
        /*private static void ReadBit(XmlReader reader)
        {
            string name = "Unknown";

            if (reader.MoveToAttribute("name"))
                name = reader.Value;
            if (!reader.MoveToAttribute("index"))
                throw new ArgumentException("Bit definitions must have an index." + PositionInfo(reader));
            int index = ParseInt(reader.Value);

            layout.VisitBit(name, index);
        }*/
        private void ReadOptions(XmlReader reader, string name, BasicFieldType type)
        {
            XmlReader subtree = reader.ReadSubtree();

            var enumLayout = new EnumLayout(name, type);
            subtree.ReadStartElement();
            while (subtree.ReadToNextSibling("option"))
                enumLayout.Add(ReadOption(subtree));

            _results.Layout.Add(new EnumTagLayoutField(name, enumLayout));
        }