I'm working in a project to get some information about Issuers. In MainWindow activity I have this line of code:
builder.AddCustomAttributes(typeof(IssuerActivity), new DesignerAttribute(typeof(IssuerDesigner)));
So I have a IssuerDesigner that I put in a listbox all of the Issuers in his contructor method and I save in an Issuer [] all of these.
Now, when I execute this rehosted workflow, I need to send this Issuer[] to IssuerActivity to analized in a foreach task everyone of them...
The question is: ¿What have I to do to for IssuerActivity gets Issuer[] that It's assigned in IssuerDesigner?
Your question is hard to follow but I beleive this is what you are looking for. You will have to use Reflection on your object to be able to grab the Attribute Values. It should be something like this.
MemberInfo[] members = builder.GetType().GetProperties();
foreach (MemberInfo m in members)
{
if (m.MemberType == MemberTypes.Property)
{
PropertyInfo p = m as PropertyInfo;
object[] attribs = p.GetCustomAttributes(false);
foreach (object attr in attribs)
{
IssuerDesigner d = attr as IssuerDesigner;
if (d != null)
{
foreach(object obj in d.Issuer)
{
DoSomething(obj);
}
}
}
}
}