Click here to Skip to main content
15,890,043 members
Home / Discussions / C#
   

C#

 
GeneralRe: Overloading default member in a C# class Pin
Kenneth Haugland8-May-16 6:21
mvaKenneth Haugland8-May-16 6:21 
GeneralRe: Overloading default member in a C# class Pin
BillWoodruff8-May-16 18:41
professionalBillWoodruff8-May-16 18:41 
QuestionICloneable class with strings Pin
WorkOnlineClick2Wealth7-May-16 18:44
WorkOnlineClick2Wealth7-May-16 18:44 
AnswerRe: ICloneable class with strings Pin
OriginalGriff7-May-16 21:09
mveOriginalGriff7-May-16 21:09 
GeneralRe: ICloneable class with strings Pin
WorkOnlineClick2Wealth8-May-16 5:00
WorkOnlineClick2Wealth8-May-16 5:00 
GeneralRe: ICloneable class with strings Pin
OriginalGriff8-May-16 5:10
mveOriginalGriff8-May-16 5:10 
GeneralRe: ICloneable class with strings Pin
WorkOnlineClick2Wealth8-May-16 6:07
WorkOnlineClick2Wealth8-May-16 6:07 
GeneralRe: ICloneable class with strings Pin
Richard Deeming9-May-16 1:50
mveRichard Deeming9-May-16 1:50 
WorkOnlineClick2Wealth wrote:
Changing the string in object B changes it in object A as well

How are you "changing" the string, given that strings in .NET are immutable? Confused | :confused:
C#
class Foo
{
    public string Bar { get; set; }
}

Foo a = new Foo { Bar = "Hello" };
Foo b = new Foo { Bar = a.Bar };

b.Bar = "Goodbye";

Console.WriteLine(a.Bar); 
// Output: "Hello"


If you can't show us the code you're using, you need to create a small sample project to reproduce the problem and show us that code instead.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: ICloneable class with strings Pin
DaveAuld8-May-16 5:37
professionalDaveAuld8-May-16 5:37 
GeneralRe: ICloneable class with strings Pin
WorkOnlineClick2Wealth8-May-16 5:46
WorkOnlineClick2Wealth8-May-16 5:46 
QuestionC# chart library with interactive elements drawing Pin
WallaceCheshire7-May-16 3:41
WallaceCheshire7-May-16 3:41 
AnswerRe: C# chart library with interactive elements drawing Pin
Ravi Bhavnani7-May-16 18:30
professionalRavi Bhavnani7-May-16 18:30 
AnswerRe: C# chart library with interactive elements drawing Pin
Kenneth Haugland7-May-16 18:31
mvaKenneth Haugland7-May-16 18:31 
QuestionWinForms issues: (partial rant, partial sharing, totally a request for opinions, comments) Pin
BillWoodruff7-May-16 2:21
professionalBillWoodruff7-May-16 2:21 
AnswerRe: WinForms issues: (partial rant, partial sharing, totally a request for opinions, comments) Pin
CHill607-May-16 4:45
mveCHill607-May-16 4:45 
QuestionWhat does Bitmap.LockBits() do? Pin
Bernhard Hiller5-May-16 21:04
Bernhard Hiller5-May-16 21:04 
AnswerRe: What does Bitmap.LockBits() do? PinPopular
OriginalGriff5-May-16 21:54
mveOriginalGriff5-May-16 21:54 
GeneralRe: What does Bitmap.LockBits() do? Pin
Bernhard Hiller5-May-16 23:22
Bernhard Hiller5-May-16 23:22 
GeneralRe: What does Bitmap.LockBits() do? Pin
OriginalGriff5-May-16 23:45
mveOriginalGriff5-May-16 23:45 
GeneralRe: What does Bitmap.LockBits() do? Pin
Rob Philpott6-May-16 5:49
Rob Philpott6-May-16 5:49 
GeneralRe: What does Bitmap.LockBits() do? Pin
OriginalGriff6-May-16 6:12
mveOriginalGriff6-May-16 6:12 
Questionenvt Pin
Member 125041034-May-16 23:52
Member 125041034-May-16 23:52 
AnswerRe: envt Pin
Eddy Vluggen5-May-16 0:06
professionalEddy Vluggen5-May-16 0:06 
AnswerRe: envt Pin
Pete O'Hanlon5-May-16 0:08
mvePete O'Hanlon5-May-16 0:08 
AnswerRe: envt Pin
Richard MacCutchan5-May-16 0:28
mveRichard MacCutchan5-May-16 0:28 

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.