We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Object in Tag property being cloned

Hi, 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. Thanks, Sue

3 Replies

AD Administrator Syncfusion Team September 4, 2003 07:01 AM UTC

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.

MB Michael Barnes October 10, 2003 03:58 AM UTC

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!

AD Administrator Syncfusion Team October 10, 2003 09:19 AM UTC

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. Stefan

Live Chat Icon For mobile
Up arrow icon