Friday, June 26, 2015

How to create a empty enumarable

We might have experienced in the MVC View, if we have Enumerable list is null  for dropdown or select box normally we get an exception.

In MVC Razor controls we need to make sure all enumerable properties of a view model object should be set by default as empty.

 

Example:

SelectedList list =  numerable.Empty<SelectedList>()

No comments:

Post a Comment