C#C
C#2y ago
Pan!cKk

Enum Capabilities

Hello there!

I was wondering if there is a way to return the string value (either description or name) rather than the enumeration value of an enum.

Take this enum for example:
public enum SourceType
{ SourceLink = 1, Channel = 2, Video = 3 }.

When I return this model:
public class Source
{ string Title; SourceType Type; },

I wonder if the value of the property Type can be string, the name of the enum (SourceLink, Channel or Video) or the description, rather than the integer value (1, 2, 3).

Has anyone done something similar? Is that even possible?
Was this page helpful?