public CodeSentenceDataObject(CodeSentence codeSentence)
        {
            if (codeSentence == null)
            {
                throw new ArgumentNullException("codeSentence");
            }

            _object      = codeSentence;
            _format      = CodeSentenceDataFormat;
            _autoConvert = true;
        }
        public object GetData(string format, bool autoConvert)
        {
            if (format != m_format)
            {
                if (!m_autoConvert || !autoConvert)
                {
                    return(null);
                }
            }

            if (format == CodeSentenceDataFormat)
            {
                if (m_format == CodeSentenceDataFormat)
                {
                    CodeSentence codeSentenceValue = m_object as CodeSentence;
                    return(codeSentenceValue);
                }

                if (m_format == DataFormats.StringFormat ||
                    m_format == DataFormats.UnicodeText)
                {
                    string stringValue = m_object as string;
                    if (stringValue != null)
                    {
                        CodeSentence[] codeSentences = Parser.Parse(stringValue);
                        if (codeSentences != null &&
                            codeSentences.Length >= 1)
                        {
                            return(codeSentences[0]);
                        }
                    }
                    return(null);
                }
            }

            if (format == DataFormats.StringFormat ||
                format == DataFormats.UnicodeText)
            {
                if (m_format == CodeSentenceDataFormat)
                {
                    CodeSentence codeSentenceValue = m_object as CodeSentence;
                    return(codeSentenceValue.ToString());
                }

                if (m_format == DataFormats.StringFormat ||
                    m_format == DataFormats.UnicodeText)
                {
                    string stringValue = m_object as string;
                    return(stringValue);
                }
            }

            return(null);
        }