support all major types

This commit is contained in:
Tommy Parnell
2014-02-24 02:13:49 -05:00
parent 408ba491bc
commit af0468b413
2 changed files with 17 additions and 5 deletions

View File

@@ -21,19 +21,29 @@ namespace SharedSettingsAbstraction.Extensions
if (refType == typeof(string))
{
ed.PutString(key,(String)value);
return;
}
if (refType == typeof(bool))
{
ed.PutBoolean(key, (bool)value);
return;
}
if (refType == typeof(int))
{
ed.PutInt(key, (int)value);
return;
}
if (refType == typeof(float))
{
ed.PutFloat(key, (float)value);
return;
}
if (refType == typeof(long))
{
ed.PutLong(key, (long)value);
return;
}
throw new InvalidOperationException("Type not supported, only use String, Bool, Int, Float, Long");
}
}
}