Skip to content

.NET Enumeration Make it configurable to add spacing between words? #228

Closed Answered by leekelleher
erikjanwestendorp asked this question in Question
Discussion options

You must be logged in to vote

@erikjanwestendorp Do you have control over the enum code? If so, you could use the DataListItemAttribute to annotate the field.

Similar to how the enum I have on the demo site: https://github.com/leekelleher/umbraco-contentment/blob/3.3.1/src/Umbraco.Cms.9.x/DataSources/RenderPosition.cs#L7

So for your example, you'd have something like...

public enum SocialMedia
{
	Facebook,

	[DataListItem(Name = "LinkedIn")]
	LinkedIn,

	Twitter,

	[DataListItem(Name = "WhatsApp")]
	WhatsApp,
}

Would that work for you?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by leekelleher
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants