I use Entity Framwork + Wcf Ria Service for Silverlight application.
Suppose there is a property defined in VM like:
private IEnumerable<MyEntity> _myEntitys;
public IEnumerable<MyEntity> MyEntitys
{
get { return _myEntitys;}
set
{
if _myEntitys;!= value)
{
_myEntitys;= value;
RaisePropertyChanged("MyEntitys");
}
}
}
then I have a single instance of MyEntity, say it's CurrentMyEntity, and a list of MyEntity, it's an EntityCollection, say it's MyMyEntityList with 2 records.
Then I want to put those together and assign it to MyEntitys. it means MyEntitys should have 3 records.
As IEnumerable is readonly, no Add method availavle. How to do it in one line of code or expression for this case?
What about:
MyEntitys = MyEntityList.Concat(new[] {CurrentMyEntity});