DirectionalAction.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / DirectionalAction.cs / 1 / DirectionalAction.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Channels
{ 
    using System.ServiceModel;
    using System.ServiceModel.Description; 
    using System.Collections.Generic; 
    internal class DirectionalAction : IComparable
    { 
        MessageDirection direction;
        string action;
        bool isNullAction;
 
        internal DirectionalAction(MessageDirection direction, string action)
        { 
            if (!MessageDirectionHelper.IsDefined(direction)) 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("direction"));
 
            this.direction = direction;
            if (action == null)
            {
                this.action = MessageHeaders.WildcardAction; 
                this.isNullAction = true;
            } 
            else 
            {
                this.action = action; 
                this.isNullAction = false;
            }
        }
 
        public MessageDirection Direction
        { get { return this.direction; } } 
 
        public string Action
        { get { return this.isNullAction ? null : this.action; } } 

        public override bool Equals(Object other)
        {
            DirectionalAction tmp = other as DirectionalAction; 
            if (tmp == null)
                return false; 
            return this.Equals(tmp); 
        }
 
        public bool Equals(DirectionalAction other)
        {
            if (other == null)
                return false; 

            return (this.direction == other.direction) 
                && (this.action == other.action); 
        }
 
        public int CompareTo(DirectionalAction other)
        {
            if (other == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other"); 

            if ((this.direction == MessageDirection.Input) && (other.direction == MessageDirection.Output)) 
                return -1; 
            if ((this.direction == MessageDirection.Output) && (other.direction == MessageDirection.Input))
                return 1; 

            return this.action.CompareTo(other.action);
        }
 
        public override int GetHashCode()
        { 
            return this.action.GetHashCode(); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK