public object GetValue(object parentobject)
        {
            string type = m_Reader.GetAttribute("Type");

            if (null != type)
            {
                if ("UndefinedValue" == type)
                {
                    m_Reader.Read();
                    return(null);
                }

                // Get the surrogate for this type
                IXmlSerializationSurrogate surr = m_SurrogateSelector.GetSurrogate(type);
                if (null == surr)
                {
                    throw new ApplicationException(string.Format("Unable to find XmlSurrogate for type {0}!", type));
                }
                else
                {
                    bool bNotEmpty = !m_Reader.IsEmptyElement;
                    // System.Diagnostics.Trace.WriteLine(string.Format("Xml val {0}, type {1}, empty:{2}",m_Reader.Name,type,bNotEmpty));


                    if (bNotEmpty)
                    {
                        m_Reader.ReadStartElement(); // note: this must now be done by  in the deserialization code
                    }
                    object retvalue = surr.Deserialize(null, this, parentobject);

                    if (bNotEmpty)
                    {
                        m_Reader.ReadEndElement();
                    }
                    else
                    {
                        m_Reader.Read();
                    }


                    return(retvalue);
                }
            }
            else
            {
                throw new ApplicationException(string.Format("Unable to deserialize element at line {0}, position {1}, Type attribute missing!", m_Reader.LineNumber, m_Reader.LinePosition));
            }
        }
 public bool IsSerializable(object o)
 {
     return(null != m_SurrogateSelector.GetSurrogate(o.GetType()));
 }