<string xmlns=''> was not expected in c#

Posted by Nishant on Stack Overflow See other posts from Stack Overflow or by Nishant
Published on 2012-11-19T16:35:45Z Indexed on 2012/11/19 17:00 UTC
Read the original article Hit count: 212

Filed under:
|
|

Hi all I am trying to serialize value in xml. Every time I am getting <string xmlns=''> was not expected in c# Not able to find root cause plz help me out here.

namespace CustomDataType.usercontrols
    {
        public partial class CustomDataTypes : System.Web.UI.UserControl, umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
        {
        private Status _umbval;
        public object value
        {
            get
            {
                var status = GetStatus();
                return SerializationHelper.ValueToXmlString(status);
            }
            set
            {
                //if (value == null || string.IsNullOrEmpty(value.ToString()))
                //{
                //    _umbval = Status.Empty;
                //}
                //else
                //{
                    _umbval   =(Status)SerializationHelper.ValueFromXmlString(value,typeof(Status));
                //}
            }
        }
    }
    }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Xml.Serialization;

    namespace CustomDataType
    {
        [Serializable]
        [XmlRoot("StatuMain")]
        public class Status
        {
                [XmlElement("statusvalue")]
                public string StatusValue { get; set; }

                [XmlElement("statusvalue1")]
                public string StatusValue1 { get; set; }

                [XmlElement("statusvalue2")]
                public string StatusValue2 { get; set; }

                [XmlElement("statusvalue3")]
                public string StatusValue3 { get; set; }

                //[XmlElement("isEmailChecked")]
                //public bool HasEmailChecked { get; set; }

                //[XmlElement("datetime")]
                //public DateTime Date { get; set; }

                public static Status Empty 
                {
                    get
                    {
                        var schedule = new Status();
                        schedule = null;
                        return schedule;
                    }
                }
        }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET