/// <summary>
        /// Get the argumentInstances for the activity, that is all the instances off the arguments that have an activity matching this one
        /// </summary>
        public static IEnumerable <WfArgumentInstance> GetOutputArgumentInstances(this WfActivity activity)
        {
            var argIds = activity.GetOutputArguments().Select(arg => arg.Id);

            return(activity.ArgumentInstanceFromActivity.Where(ai => ai.ArgumentInstanceArgument != null && argIds.Contains(ai.ArgumentInstanceArgument.Id)));
        }
 public static ActivityArgument GetOutputArgument(this WfActivity activity, string implementationName)
 {
     return(activity.GetOutputArguments().FirstOrDefault(a => a.Name == implementationName));     // note that his code assumes the first type is an activity type
 }