public override bool Read()
        {
            if (_nodeType == XmlNodeType.Attribute && MoveToNextAttribute())
            {
                return(true);
            }

            MoveNext(_element.dataNode);

            switch (_internalNodeType)
            {
            case ExtensionDataNodeType.Element:
            case ExtensionDataNodeType.ReferencedElement:
            case ExtensionDataNodeType.NullElement:
                PushElement();
                SetElement();
                break;

            case ExtensionDataNodeType.Text:
                _nodeType       = XmlNodeType.Text;
                _prefix         = String.Empty;
                _ns             = String.Empty;
                _localName      = String.Empty;
                _attributeCount = 0;
                _attributeIndex = -1;
                break;

            case ExtensionDataNodeType.EndElement:
                _nodeType       = XmlNodeType.EndElement;
                _prefix         = String.Empty;
                _ns             = String.Empty;
                _localName      = String.Empty;
                _value          = String.Empty;
                _attributeCount = 0;
                _attributeIndex = -1;
                PopElement();
                break;

            case ExtensionDataNodeType.None:
                if (_depth != 0)
                {
                    throw new XmlException(SR.InvalidXmlDeserializingExtensionData);
                }
                _nodeType       = XmlNodeType.None;
                _prefix         = String.Empty;
                _ns             = String.Empty;
                _localName      = String.Empty;
                _value          = String.Empty;
                _attributeCount = 0;
                _readState      = ReadState.EndOfFile;
                return(false);

            case ExtensionDataNodeType.Xml:
                // do nothing
                break;

            default:
                Fx.Assert("ExtensionDataReader in invalid state");
                throw new SerializationException(SR.InvalidStateInExtensionDataReader);
            }
            _readState = ReadState.Interactive;
            return(true);
        }
 internal KnownTypeDataContractResolver(XmlObjectSerializerContext context)
 {
     Fx.Assert(context != null, "KnownTypeDataContractResolver should not be instantiated with a null context");
     _context = context;
 }