The main reason we don't return list<T> is simply because the ListModel is not internally represented as a list, so that would be a potentially expensive conversion that is not needed in all cases.

Now, I admit that seq<T> is not ideal either; maybe we should have made it return a T[], documented with a warning against mutating this array? We could also add something like ViewAsList as a separate property.

Either way, we will soon be bumping the framework requirement for WebSharper to .NET 4.6.1 in WebSharper 4.1, and that will allow us to return a View<IReadOnlyList<T>>, which is better than a seq<T>.

As a side note, I don't know your exact use case, but you might want to look into .MapSeqCached() and .DocSeqCached() instead of converting to lists. There will also be .Map() and .Doc() on the ListModel itself, coming in WS 4.1.

By on 10/12/2017 8:04 AM ()

I understand. Thanks!

By on 10/12/2017 10:16 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper