Exemplo n.º 1
0
        /// <summary>
        /// Get a int value for a property.
        /// This method is convenient but inefficient.  It should be used
        /// infrequently(i.e. for initializing, loading, saving, etc.),
        /// not in the main loop.If you need to get a value frequently,
        /// it is better to look up the node itself using GetNode and then
        /// use the node's getIntValue() method, to avoid the lookup overhead.
        /// </summary>
        /// <param name="name">The property name.</param>
        /// <param name="defaultValue">The default value to return if the property does not exist.</param>
        /// <returns>The property's value as a int, or the default value provided.</returns>
        public int GetInt(string name, int defaultValue = 0)
        {
            PropertyNode node = GetNode(name);

            return(node == null ? defaultValue : node.GetInt32());
        }