I've got a GridControl, and I store an object in the row header tags. One of my objects that I store implements ICloneable, and for some reason, this object seems to be getting cloned. Is there any way to prevent this? I want to be able to do a ReferenceEquals on the tag object, but can't as the Tag object is a clone of my original.
I store the object in the tag like so:
this.gridControl1[i+1,0].Tag = cloneClass;
And I retrieve it:
CloneClass c = this.gridControl1[row,0].Tag as CloneClass;
Am I doing something wrong? I can provide a really simple example of this problem if it helps.
ADAdministrator Syncfusion Team September 4, 2003 02:01 AM
If your tag object class implements ICloneable, then it will get cloned when setting style objects. This is by design.
If you don't want it cloned, then you will have to wrap your tag object in a class that does not implement ICloneable.
MBMichael BarnesOctober 9, 2003 10:58 PM
This "cloneing" effect also occurs to anything you set as a CellValue. In this case I think that is not a good design decision - if I assign something as the CellValue, then I expect to get that same thing back when I ask for it later!
Furthermore, if this is the behaviour, then it damn well ought to be documented as such - its pretty critical if you are using references to large objects as CellValues, and they are getting cloned behind your back!
ADAdministrator Syncfusion Team October 10, 2003 04:19 AM
We will add a IsCloneable property in the StyleInfoProperty class which lets you specify application-wide if the property should support calling Clone when the value is ICloneable.
Sorry for the inconvinience.