Skip to main content

Hello Gang,

I have a customization project that I need to get a sealed class result ApproveInfo(the members of the class are StepID, RuleID, OwnerID, WorkgroupID and WaitTime). Below is my extension:

public virtual IEnumerable<ApproveInfo> GetApproversFromNextStep_Extension(SourceAssign Source, EPAssignmentMap AssignmentMap, int? CurrentStepSequence)
{
if (AssignmentMap == null)
{
yield break;
}

EPAssignmentProcessor<SourceAssign> assignmentProcessor = new EPAssignmentProcessor<SourceAssign>(_Graph);
foreach (ApproveInfo approveInfo in assignmentProcessor.Approve(Source, AssignmentMap, CurrentStepSequence))
{
yield return approveInfo;
}
}

Now I need the sealed calss members and values. below is the code calling the class to get these five fields but it doesn’t work for me. the result assigned to approveInfo is considered as a vaiable but I would like to access approveInfo.StepID, approveInfo.RuleID … and get their values. What I am doing wrong?

IEnumerable<ApproveInfo> approveInfo = Approval.GetApproversFromNextStep_Extension(document, assignmentMap, stepBase.Sequence);

Any help is appreciated.

I guess there should be a better way to get the expected result but here is what I did to get the five members value and works for me.

Guid? approvalStepID = approveInfo.Select(item => item.StepID).ToList().FirstOrDefault();
Guid? approvalRuleID = approveInfo.Select(item => item.RuleID).ToList().FirstOrDefault();
int? approvalOwnerID = approveInfo.Select(item => item.OwnerID).ToList().FirstOrDefault();
int? approvalWorkgroupID = approveInfo.Select(item => item.WorkgroupID).ToList().FirstOrDefault();
int? approvalWaitTime = approveInfo.Select(item => item.WaitTime).ToList().FirstOrDefault();

 


Reply