You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 16, 2022. It is now read-only.
[DataContract]
public class Physics
{
[DataMember]
public string Lecturer { get; set; }
[DataMember]
public WeekDays WeekDay { get; set; }
}
[DataContract]
public enum WeekDays : byte
{
[EnumMember]
Monday = 1,
[EnumMember]
Tuesday,
[EnumMember]
Wednesday,
[EnumMember]
Thursday,
[EnumMember]
Friday,
[EnumMember]
Saturday,
[EnumMember]
Sunday
}
Here is my Main() method.
static void Main(string[] args)
{
Physics physics_1 = new Physics { Lecturer = "Andrew", WeekDay = WeekDays.Monday };
var v1 = JsonSerializer.Serialize(physics_1, EnumResolver.UnderlyingValue);
Console.WriteLine(Encoding.UTF8.GetString(v1));
}
I want to serialize a Physics object and also I want an enum member of Physics to be a number. While using EnumResolver.UnderlyingValue I got this `exception.`
Physics is not registered in this resolver. resolver:EnumUnderlyingValueResolver
The text was updated successfully, but these errors were encountered:
armanzakinyan
changed the title
<Class> is not registered in this resolver. An exception occurs while serializing an enum as number
<Class> is not registered in this resolver(resolver:EnumUnderlyingValueResolver). An exception occurs while serializing an enum as number
Dec 4, 2020
armanzakinyan
changed the title
<Class> is not registered in this resolver(resolver:EnumUnderlyingValueResolver). An exception occurs while serializing an enum as number
<Class> is not registered in this resolver(EnumUnderlyingValueResolver). An exception occurs while serializing an enum as number
Dec 4, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have these classes below.
The text was updated successfully, but these errors were encountered: