Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

I’ve created an extension method  to Find Sibling Activity by name
Based on example from http://msdn.microsoft.com/en-us/magazine/cc163414.aspx
public static TActivity FindSiblingActivity<TActivity>(this Activity sender,string activityName) where TActivity:Activity
{
//CodeActivity thisActivityInstance = sender as   CodeActivity;sender.
Activity parent =   sender.Parent;
   var retActivity=parent.GetActivityByName(activityName) as TActivity;
   Debug.Assert(sender.IsDynamicActivity==retActivity.IsDynamicActivity," EXPECTED BOTH BE DYNAMIC");
   return retActivity;
}
Related links http://geekswithblogs.net/mnf/archive/2009/04/21/workflow-activities-should-be-referred-by-sender-object-or.aspx
http://codeidol.com/other/essential-windows-workflow-foundation/Advanced-Activity-Execution/Activity-Execution-Context/

Posted on Tuesday, May 17, 2011 7:07 AM Workflow | Back to top


Comments on this post: An extension method to Find Sibling Activity

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net