Encog.Persist.EncogFileSection.ParseBoolean C# (CSharp) Method

ParseBoolean() public static method

Parse a boolean from a name-value collection of params.
public static ParseBoolean ( String>.IDictionary paras, String name ) : bool
paras String>.IDictionary The name-value pairs.
name String The name to parse.
return bool
        public static bool ParseBoolean(IDictionary<String, String> paras,
                                        String name)
        {
            String v = null;
            try
            {
                v = paras[name];
                if (v == null)
                {
                    throw new PersistError("Missing property: " + name);
                }

                return v.Trim().ToLower()[0] == 't';
            }
            catch (FormatException )
            {
                throw new PersistError("Field: " + name + ", "
                                       + "invalid integer: " + v);
            }
        }