Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See if we can not use IEnumerable for Multivalue properties. #3

Open
rsleggett opened this issue Aug 26, 2014 · 0 comments
Open

See if we can not use IEnumerable for Multivalue properties. #3

rsleggett opened this issue Aug 26, 2014 · 0 comments

Comments

@rsleggett
Copy link
Contributor

Multivalue fields must be of type IEnumerable for example:

[EmbeddedValues("slides", typeof(HomepageCarouselSlideViewModel), IsMultiValue = true)]
public IEnumerable Slides { get; set; }

This is bad because IEnumerables cannot be reliably updated so code like

foreach(var slide in model.Slides)
{
slide.SomeProp = "somevalue";
}

The value of SomeProp could not be guarenteed to be set on the next enumeration.

Current workaround is to enumerate with ToList and then set this back to the property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant