Adding Enum deserialization
Fixing issue in SessionBase where it does not correctly deserialize Enum's
This commit is contained in:
parent
193a4811bf
commit
46e65faf31
@ -145,6 +145,16 @@ namespace TelegramBotBase
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (f.PropertyType.IsEnum)
|
||||||
|
{
|
||||||
|
var ent = Enum.Parse(f.PropertyType, p.Value.ToString());
|
||||||
|
|
||||||
|
f.SetValue(form, ent);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
f.SetValue(form, p.Value);
|
f.SetValue(form, p.Value);
|
||||||
}
|
}
|
||||||
catch (ArgumentException ex)
|
catch (ArgumentException ex)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user