.net 中Unit已經標記了Serializable了
[Serializable]
[TypeConverter(typeof(UnitConverter))]
public struct Unit
{
}
我定義了個類,其中有個width屬性
Unit width;
[DefaultValue(typeof(Unit), "")]
[Bindable(true)]
[Description("列寬")]
public Unit Width
{
get { return width; }
set { width = value; }
}
序列化后為<Width/>