コード例 #1
0
ファイル: NamedColor.cs プロジェクト: olesar/Altaxo
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (NamedColor)obj;

                info.AddValue("Color", s.Color.ToInvariantString());
                info.AddValue("Name", s._name); // use _name instead of Name, to make sure _name is null if name was autogenerated

                if (null != s._parent)
                {
                    var colorSetName = s._parent.Name;
                    if (!object.ReferenceEquals(NamedColors.Instance, s._parent) && null == info.GetProperty(ColorSet.GetSerializationRegistrationKey(s._parent)))
                    {
                        info.AddValue("Set", s._parent);
                    }
                    else
                    {
                        info.AddValue("SetName", s._parent.Name);
                    }
                }
            }