Click here to Skip to main content
15,927,694 members
Home / Discussions / C#
   

C#

 
GeneralNT Service Pin
RickZ13-Apr-04 8:42
RickZ13-Apr-04 8:42 
GeneralRe: NT Service Pin
Heath Stewart13-Apr-04 9:01
protectorHeath Stewart13-Apr-04 9:01 
GeneralPassing control Pin
Howard789013-Apr-04 7:59
Howard789013-Apr-04 7:59 
GeneralRe: Passing control Pin
Nick Parker13-Apr-04 8:18
protectorNick Parker13-Apr-04 8:18 
QuestionIs there an fast way to make a copy of ArrayList ? Pin
Andres Coder13-Apr-04 7:42
Andres Coder13-Apr-04 7:42 
AnswerRe: Is there an fast way to make a copy of ArrayList ? Pin
Judah Gabriel Himango13-Apr-04 7:51
sponsorJudah Gabriel Himango13-Apr-04 7:51 
GeneralRe: Is there an fast way to make a copy of ArrayList ? Pin
Andres Coder13-Apr-04 8:03
Andres Coder13-Apr-04 8:03 
GeneralRe: Is there an fast way to make a copy of ArrayList ? Pin
Heath Stewart13-Apr-04 8:33
protectorHeath Stewart13-Apr-04 8:33 
Yes, so long as what the ArrayList contains are reference types. If you want to perform a deep copy, you could do something like this:
private ArrayList Copy(ArrayList list)
{
  if (list == null) throw new ArgumentNullException("list");
  ArrayList copy = (ArrayList)list.Clone();
  for (int i=0; i<copy.Count; i++)
    if (copy[i] is ICloneable) copy[i] = ((ICloneable)copy[i]).Clone();
  return copy;
}
So long as the objects that the list contains are cloneable, you'll clones depending on the internal implement (perhaps deep or only partly deep).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Is there an fast way to make a copy of ArrayList ? Pin
Heath Stewart13-Apr-04 8:30
protectorHeath Stewart13-Apr-04 8:30 
GeneralRichTextBox and ITextHost Pin
Michael Wolski13-Apr-04 3:00
Michael Wolski13-Apr-04 3:00 
GeneralRe: RichTextBox and ITextHost Pin
Heath Stewart13-Apr-04 3:49
protectorHeath Stewart13-Apr-04 3:49 
GeneralHoly Crap! Pin
Michael Wolski13-Apr-04 4:17
Michael Wolski13-Apr-04 4:17 
GeneralRe: Holy Crap! Pin
Heath Stewart13-Apr-04 4:24
protectorHeath Stewart13-Apr-04 4:24 
GeneralRe: Holy Crap! Pin
Nick Parker13-Apr-04 8:14
protectorNick Parker13-Apr-04 8:14 
GeneralSucess! Pin
Michael Wolski14-Apr-04 4:47
Michael Wolski14-Apr-04 4:47 
GeneralRe: Sucess! Pin
Heath Stewart14-Apr-04 7:08
protectorHeath Stewart14-Apr-04 7:08 
Generalspeech recognition Pin
AlNair13-Apr-04 2:54
AlNair13-Apr-04 2:54 
GeneralRe: speech recognition Pin
Heath Stewart13-Apr-04 4:32
protectorHeath Stewart13-Apr-04 4:32 
GeneralRe: speech recognition Pin
Nick Parker13-Apr-04 8:22
protectorNick Parker13-Apr-04 8:22 
GeneralRe: speech recognition Pin
Heath Stewart13-Apr-04 8:28
protectorHeath Stewart13-Apr-04 8:28 
GeneralRe: speech recognition Pin
Nick Parker13-Apr-04 8:59
protectorNick Parker13-Apr-04 8:59 
GeneralRe: speech recognition Pin
AlNair13-Apr-04 15:42
AlNair13-Apr-04 15:42 
General.NET Custom proxies Pin
Prasad Anand13-Apr-04 2:33
Prasad Anand13-Apr-04 2:33 
GeneralRe: .NET Custom proxies Pin
Heath Stewart13-Apr-04 3:18
protectorHeath Stewart13-Apr-04 3:18 
Generalappend keyboard/mouse input from a service when not logged in Pin
Member 69656813-Apr-04 2:14
Member 69656813-Apr-04 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.