idTech4.idDict.GetBool C# (CSharp) Method

GetBool() public method

public GetBool ( string key, bool defaultValue = false ) : bool
key string
defaultValue bool
return bool
		public bool GetBool(string key, bool defaultValue = false)
		{
			string str;

			if(_dict.TryGetValue(key, out str) == true)
			{
				if(str.ToString() == "1")
				{
					return true;
				}
				else if(str.ToString() == "0")
				{
					return false;
				}
				else
				{
					bool tmp;
					bool.TryParse(str.ToString(), out tmp);

					return tmp;
				}
			}

			return defaultValue;
		}