Friday, May 8, 2020

What does the [EnumMember] attribute do in C#?

Meh. It allows that which is serializable to be deserialized as an enum.

using System.Runtime.Serialization;
namespace Ecs.Domain.Health.Web.Models
{
   [DataContract(Name = "mode", Namespace =
         Namespaces.PrtgModelsNamespace)]
   public enum PrtgModeType
   {
      [EnumMember]
      Absolute,
      [EnumMember]
      Difference
   }
}

No comments:

Post a Comment