icloneable Questions

3

Solved

I've done some reading and cant seem to wrap my head around what the best approach would be to clone a List(of class) in my VB2010 project. I have three classes that are related like so Public Cla...
Bifocal asked 22/1, 2013 at 20:30

7

What is the proper way of implementing ICloneable in a class hierarchy? Say I have an abstract class DrawingObject. Another abstract class RectangularObject inherits from DrawingObject. Then there ...
Wershba asked 14/1, 2014 at 14:53

4

Solved

I am porting an existing .NET class library to a Portable Class Library. The .NET library makes extensive use of the ICloneable interface, which is not included in the portable subset. Typically,...
Nonsuit asked 4/12, 2013 at 13:18

8

Solved

Is there a particular reason why a generic ICloneable<T> does not exist? It would be much more comfortable, if I would not need to cast it everytime I clone something.
Fancied asked 11/2, 2009 at 11:13

2

Solved

Resharper complains about the following code, saying that the last null check is redundant as the 'expression is always false': ICloneable data = item as ICloneable; if (data == null) throw new...
Phonology asked 12/6, 2014 at 19:11

3

Surprisingly, String.Clone() doesn't return a copy of a string as String.Copy() would do. Instead, it returns 'this', the original string. I would like to understand why the .Net Framework team ch...
Heida asked 18/12, 2013 at 20:8

1

Solved

Assume I have a class A, and B which derives from A: class A : ICloneable { public object Clone() {...} } class B : A, ICloneable { public object Clone() {...} } which gives 'B.Clone()' hide...
Debbee asked 31/12, 2012 at 16:6

6

Solved

Check this code: .. class someclass : IDisposable{ private Bitmap imageObject; public void ImageCrop(int X, int Y, int W, int H) { imageObject = imageObject.Clone(new Rectangle(X, Y, W, H), im...
Acrocarpous asked 8/1, 2012 at 22:10

4

Solved

I have the following: public class InstanceList : List<Instance> {} I would like to make this cloneable. Following the example here: Why no ICloneable<T>? I tried the following: ...
Carvelbuilt asked 2/8, 2011 at 18:43

4

Solved

Can you explain to me why I should inherit from ICloneable and implement the Clone() method? If I want to do a deep copy, can't I just implement my method? Let's say MyClone()? Why should I inher...
Beckerman asked 30/3, 2009 at 22:1
1

© 2022 - 2024 — McMap. All rights reserved.