diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-08 11:54:30 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-08 11:54:30 +0100 |
| commit | d810ad18dc2a1908211b6967d666c915140f24c9 (patch) | |
| tree | 13a031d1eab76d1be985ae2aa2cbffcd99ba4516 /src/GraphicObjects/GraphicObject.cs | |
| parent | 10b0b2b477b926ea4084a1a38c9b822d2c4a8846 (diff) | |
paged ListBox
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index d7567659..43b9a725 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -21,7 +21,7 @@ using System.Reflection.Emit; namespace Crow { - public class GraphicObject : IXmlSerializable, ILayoutable, IValueChange + public class GraphicObject : IXmlSerializable, ILayoutable, IValueChange, ICloneable { #if DEBUG_LAYOUTING internal static ulong currentUid = 0; @@ -462,7 +462,7 @@ namespace Crow } public virtual GraphicObject FindByName(string nameToFind){ - return nameToFind == _name ? this : null; + return string.Equals(nameToFind, _name, StringComparison.Ordinal) ? this : null; } public virtual bool Contains(GraphicObject goToFind){ return false; @@ -1381,5 +1381,30 @@ namespace Crow } #endregion + #region ICloneable implementation + public object Clone () + { + Type type = this.GetType (); + GraphicObject result = (GraphicObject)Activator.CreateInstance (type); + + foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { + if (pi.GetSetMethod () == null) + continue; + + if (pi.GetCustomAttribute<XmlIgnoreAttribute> () != null) + continue; + +// object[] att = pi.GetCustomAttributes (false); +// foreach (object o in att) { +// XmlIgnoreAttribute xia = o as XmlIgnoreAttribute; +// if (xia != null) +// continue; +// } + + pi.SetValue(result, pi.GetValue(this)); + } + return result; + } + #endregion } } |