icloneable

Creating objects driven by the database to populate a Treeview - very slow

I have an application that reads a table from a database. I issue an SQL query to get a result set, based on a unique string value I glean from the results, I use a case/switch statement to generate certain objects (they inherit TreeNode BTW). These created objects get shunted into a Dictionary object to be used later. Whilst generat...

A doubt with the ICloneable interface in petshop 4.0 ?

In the 'DBUtility' project of Petshop 4.0,the abstract class SqlHelper has a method 'GetCachedParameters': public static SqlParameter[] GetCachedParameters(string cacheKey) { SqlParameter[] cachedParms = (SqlParameter[])parmCache[cacheKey]; if (cachedParms == null) return null; SqlParameter[...

Why no ICloneable<T> ?

Is there a particular reason why a generic ICloneable does not exist? it would be much more comfortable if I would not need to cast it everytime I clone something ...

C# Stack overflow

Hi, I am trying to find out why i am getting a stack overflow exception. I am creating a simple card game for a school assignment and when i clone the cards to return them i get the stack overflow exception. So i got this card class: public class Card : ICloneable { .... #region ICloneable Members public object Clone() ...

Implementing the ICloneable Interface C#(Question on Deep Cloning)

Hello, I was looking at code that implemented the ICloneable interface for one of the classes. The class was as follows: public class TempClass { String[] names; String[] values; } A partial class was created that implemented TempClass public partial class TempClass:ICloneable { public Object Clone() { TempClass clo...

What's the opposite of 'clone'?

I have a class that implements ICloneable. I need it to have a backup of an entity, so when the user clicks cancel, etc., I have all values asides. I want to create in the cloneable class another function, that clones in, i.e. receives another class of the same type and uses the same clone but to the opposite direction while the other m...

ICloneable Vs Strongly Typed Function Vs Being Lazy

Hi Folks I need to deep clone some custom objects that references other custom objects and these may reference other cust... and so on you get the idea. I'm just at the documentation & conception stage at the moment so wan't to get it right. Q1. Why implement ICloneable and return an object when you could write a strongly typed custom ...