简体   繁体   中英

How to add item to IEnumerable<T> in Workflow?

I'm trying to create a workflow and inside it, I need to add a several object to IEnumerable.

In my class this IEnumerable looks like:

[DataMember]
public virtual IEnumerable<Account> TargetAccounts { get; set; }

In workflow I am addind new created Account to it.

The problem is: In tollbox there are only AddToCollection component, and of cource its works only with Collection.

Is there any way to simply add new object to IEnumerable WITHOUT creating new CodeActivity for this action?

PS Sorry for my bad English.

IEnumerable doens't support adding items to it.It allows only to view the contents of a collection. Not to modify the values.Change your datamember like this,

[DataMember]
public virtual List<Account> TargetAccounts { get; set; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM