Click here to Skip to main content
15,886,806 members
Articles / Programming Languages / C#

Pipes and Filters concurrent Design Pattern using the Concurrency and Coordination Runtime

Rate me:
Please Sign up or sign in to vote.
3.67/5 (3 votes)
8 Oct 2008Ms-PL4 min read 37.5K   373   21  
A modular approach for concurrent message passing.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WorkCardDemo
{
    public abstract class WorkCardSwipeMessageBase
    {
        public string Name { get; private set; }

        protected WorkCardSwipeMessageBase(string name)
        {
            Name  = name;
        }

        public override string ToString()
        {
            return String.Format("Message : Worker Name = {0}", Name);
        }
    }

    public class CorrectPinMessage : WorkCardSwipeMessageBase
    {
        public CorrectPinMessage(string name)
            : base(name)
        {
        }

        public override string ToString()
        {
            return String.Format("PIN Success {0}", base.ToString());
        }
    }

    public class WrongPinMessage : WorkCardSwipeMessageBase
    {
        public string _door { get; private set; }

        public WrongPinMessage(string name,string door)
            : base(name)
        {
            _door = door;
        }

        public override string ToString()
        {
            return String.Format("PIN Failure {0} @ {1}",  base.ToString(), _door);
        }
    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions