Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem decrypting a file Pin
Sasuko19-Oct-05 22:29
Sasuko19-Oct-05 22:29 
AnswerRe: problem decrypting a file Pin
leppie19-Oct-05 22:39
leppie19-Oct-05 22:39 
News71-528: TS: Microsoft® .NET Framework 2.0 - Web-based Client Development Pin
vipul_vips19-Oct-05 12:16
vipul_vips19-Oct-05 12:16 
QuestionCOM Collections: How to use get_Item(ref object index) Pin
dkarlton19-Oct-05 12:07
dkarlton19-Oct-05 12:07 
AnswerRe: COM Collections: How to use get_Item(ref object index) Pin
leppie19-Oct-05 19:49
leppie19-Oct-05 19:49 
GeneralRe: COM Collections: How to use get_Item(ref object index) Pin
dkarlton20-Oct-05 3:12
dkarlton20-Oct-05 3:12 
GeneralRe: COM Collections: How to use get_Item(ref object index) Pin
dkarlton20-Oct-05 3:33
dkarlton20-Oct-05 3:33 
QuestionConfused On References Pin
budidharma19-Oct-05 12:01
budidharma19-Oct-05 12:01 
I've got an ArrayList of objects. I call up a form to create a new object from one of the objects in the array.
User selects the object to create the new object from.

Now, I need to create a new object from the old object, so I thought this would work:

ArrayList objects = new Arraylist();
objects.Add(obj1);
obects.Add(obj2);
...

MyObject newobject = new MyObject();
{ ... iteratate through arraylist, find correct object }
newobject = correctObjectFromArrayList;

newobject.name = newobjectname;

objects.Add(newobject);

... and now I've modified both objects!
Both objects contain the changes I've made. Why is that?
In C++, if I did this, it would work.
It seems that C# uses references by default? I created a new object, not a pointer to an object.
I'm very confused. Can someone sort me out?

Thanks.

AnswerRe: Confused On References Pin
Matt Gerrans19-Oct-05 16:34
Matt Gerrans19-Oct-05 16:34 
GeneralRe: Confused On References Pin
budidharma19-Oct-05 17:32
budidharma19-Oct-05 17:32 
GeneralRe: Confused On References Pin
Matt Gerrans19-Oct-05 18:07
Matt Gerrans19-Oct-05 18:07 
GeneralRe: Confused On References Pin
S. Senthil Kumar19-Oct-05 23:04
S. Senthil Kumar19-Oct-05 23:04 
GeneralRe: Confused On References Pin
budidharma20-Oct-05 3:30
budidharma20-Oct-05 3:30 
GeneralRe: Confused On References Pin
S. Senthil Kumar20-Oct-05 4:30
S. Senthil Kumar20-Oct-05 4:30 
GeneralRe: Confused On References Pin
budidharma20-Oct-05 4:51
budidharma20-Oct-05 4:51 
GeneralRe: Confused On References Pin
S. Senthil Kumar20-Oct-05 5:41
S. Senthil Kumar20-Oct-05 5:41 
GeneralRe: Confused On References Pin
budidharma20-Oct-05 6:07
budidharma20-Oct-05 6:07 
GeneralRe: Confused On References Pin
Matt Gerrans20-Oct-05 5:34
Matt Gerrans20-Oct-05 5:34 
QuestionC# 1byte-1char strings Pin
Dave Shaw19-Oct-05 10:49
Dave Shaw19-Oct-05 10:49 
AnswerRe: C# 1byte-1char strings Pin
leppie19-Oct-05 11:04
leppie19-Oct-05 11:04 
AnswerRe: C# 1byte-1char strings Pin
Dave Kreskowiak19-Oct-05 14:04
mveDave Kreskowiak19-Oct-05 14:04 
GeneralRe: C# 1byte-1char strings Pin
lmoelleb19-Oct-05 20:58
lmoelleb19-Oct-05 20:58 
AnswerRe: C# 1byte-1char strings Pin
uno freeware19-Oct-05 16:45
uno freeware19-Oct-05 16:45 
AnswerRe: C# 1byte-1char strings Pin
Daniel Turini20-Oct-05 0:07
Daniel Turini20-Oct-05 0:07 
QuestionKeyboard Events Pin
ShimiG19-Oct-05 10:31
ShimiG19-Oct-05 10:31 

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.