System.Runtime.Remoting.Channels.BaseTransportHeaders.GetValueFromHeaderIndex C# (CSharp) Method

GetValueFromHeaderIndex() private method

private GetValueFromHeaderIndex ( int index ) : Object
index int
return Object
        internal Object GetValueFromHeaderIndex(int index)
        {
            // NOTE: If this method returns the null, then that indicates the header has no
            //   value (i.e. isn't in the "dictionary"). For the purposes of iteration, this
            //   means that the header should be skipped.
        
            // 0) CommonTransportKeys.ConnectionId
            // 1) CommonTransportKeys.IPAddress
            // 2) CommonTransportKeys.RequestUri
            // 3) "Content-Type"

            switch (index)
            {
            case 0: return _connectionId;
            case 1: return _ipAddress;            
            case 2: return _requestUri;
            case 3: return _contentType;
            
            default: return null;
            }
            
        } // MapHeaderIndexToValue

Usage Example

Exemplo n.º 1
0
        } // BaseTransportHeadersEnumerator

        public bool MoveNext()
        {
            if (_currentIndex != -1)
            {
                if (_bStarted)
                {
                    _currentIndex++;
                }
                else
                {
                    _bStarted = true;
                }

                while (_currentIndex != -1)
                {
                    if (_currentIndex >= BaseTransportHeaders.WellknownHeaderCount)
                    {
                        _otherHeadersEnumerator = _headers.GetOtherHeadersEnumerator();
                        _currentIndex           = -1;
                    }
                    else
                    {
                        if (_headers.GetValueFromHeaderIndex(_currentIndex) != null)
                        {
                            return(true);
                        }

                        _currentIndex++;
                    }
                }
            }

            if (_otherHeadersEnumerator != null)
            {
                if (!_otherHeadersEnumerator.MoveNext())
                {
                    _otherHeadersEnumerator = null;
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        } // MoveNext