summaryrefslogtreecommitdiff
path: root/StardewModdingAPI/Extensions.cs
diff options
context:
space:
mode:
authorClxS <slxxls92@gmail.com>2016-03-03 20:17:40 +0000
committerClxS <slxxls92@gmail.com>2016-03-03 20:17:40 +0000
commitf77e922ad08078586b1c67f0d88f68b054364434 (patch)
tree176788af61d48b689e98a9a0fdc1facff1eab242 /StardewModdingAPI/Extensions.cs
parentd3f0e00db9946d1b509f0ad72f9a51095c190f9f (diff)
parent9a1b910ea32f518b605c88315f192afc6fc40f28 (diff)
downloadSMAPI-f77e922ad08078586b1c67f0d88f68b054364434.tar.gz
SMAPI-f77e922ad08078586b1c67f0d88f68b054364434.tar.bz2
SMAPI-f77e922ad08078586b1c67f0d88f68b054364434.zip
Merged Zoryn4163/master into master
Diffstat (limited to 'StardewModdingAPI/Extensions.cs')
-rw-r--r--StardewModdingAPI/Extensions.cs19
1 files changed, 15 insertions, 4 deletions
diff --git a/StardewModdingAPI/Extensions.cs b/StardewModdingAPI/Extensions.cs
index d2d8dce8..1bd589db 100644
--- a/StardewModdingAPI/Extensions.cs
+++ b/StardewModdingAPI/Extensions.cs
@@ -29,15 +29,26 @@ namespace StardewModdingAPI
return result;
}
- public static bool IsInt32(this string s)
+ public static bool IsInt32(this object o)
{
int i;
- return Int32.TryParse(s, out i);
+ return Int32.TryParse(o.ToString(), out i);
}
- public static Int32 AsInt32(this string s)
+ public static Int32 AsInt32(this object o)
{
- return Int32.Parse(s);
+ return Int32.Parse(o.ToString());
+ }
+
+ public static bool IsBool(this object o)
+ {
+ bool b;
+ return Boolean.TryParse(o.ToString(), out b);
+ }
+
+ public static bool AsBool(this object o)
+ {
+ return Boolean.Parse(o.ToString());
}
public static int GetHash(this IEnumerable enumerable)