大家好,我正在尝试序列化 xml 中的值。每次我<string xmlns=''>
在 c# 中都没有预料到 无法找到根本原因,请在这里帮助我。
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;
}
}
}
}