Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to "copy local dependencies" in C# !? Pin
Frank Horn24-Jul-08 4:28
Frank Horn24-Jul-08 4:28 
GeneralRe: how to "copy local dependencies" in C# !? Pin
Skeletor2328-Jul-08 22:32
Skeletor2328-Jul-08 22:32 
GeneralRe: how to "copy local dependencies" in C# !? Pin
Frank Horn28-Jul-08 23:25
Frank Horn28-Jul-08 23:25 
AnswerRe: how to "copy local dependencies" in C# !? Pin
J a a n s24-Jul-08 4:45
professionalJ a a n s24-Jul-08 4:45 
QuestionStruct / Class strange problem Pin
lune1224-Jul-08 4:16
lune1224-Jul-08 4:16 
AnswerRe: Struct / Class strange problem Pin
leppie24-Jul-08 4:31
leppie24-Jul-08 4:31 
AnswerRe: Struct / Class strange problem Pin
User 665824-Jul-08 6:56
User 665824-Jul-08 6:56 
AnswerRe: Struct / Class strange problem Pin
Guffa24-Jul-08 11:10
Guffa24-Jul-08 11:10 
In addition to what has already been said:

Mutable structs (ones where you can change the members) should generally be avoided, for just the reason that you have experienced. If you make the struct immutable, it would work, as then you would have to create a new instance to get one with a different value:
public struct Struct1 {
   private string _s;
   public Struct1(string d) {
       _s = d;
   }
   public string S { get { return _s; } }
}

static void Main(string[] args) {
   List<struct1> ls = new List<struct1>();
   Struct1 str = new Struct1("f");
   ls.Add(str);
   // This won't compile:
   // ls[0].S = "hi";
   // You have to:
   ls[0] = new Struct1("hi");
   string mys = ls[0].S;
   Console.WriteLine("mys: " + mys);
}</struct1></struct1>

Structs are tricker to implement correctly than classes, so unless you really need a struct, just stick with classes.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Struct / Class strange problem Pin
lune1227-Jul-08 21:00
lune1227-Jul-08 21:00 
QuestionKilling a byte array? Pin
Justin Time24-Jul-08 4:06
Justin Time24-Jul-08 4:06 
AnswerRe: Killing a byte array? Pin
Luc Pattyn24-Jul-08 4:33
sitebuilderLuc Pattyn24-Jul-08 4:33 
GeneralRe: Killing a byte array? Pin
Justin Time24-Jul-08 4:48
Justin Time24-Jul-08 4:48 
GeneralRe: Killing a byte array? Pin
Luc Pattyn24-Jul-08 5:02
sitebuilderLuc Pattyn24-Jul-08 5:02 
GeneralRe: Killing a byte array? Pin
Justin Time24-Jul-08 6:07
Justin Time24-Jul-08 6:07 
GeneralRe: Killing a byte array? Pin
Luc Pattyn24-Jul-08 7:27
sitebuilderLuc Pattyn24-Jul-08 7:27 
GeneralRe: Killing a byte array? Pin
Justin Time24-Jul-08 8:14
Justin Time24-Jul-08 8:14 
GeneralRe: Killing a byte array? Pin
Luc Pattyn24-Jul-08 9:06
sitebuilderLuc Pattyn24-Jul-08 9:06 
GeneralRe: Killing a byte array? [modified] Pin
DaveyM6924-Jul-08 23:07
professionalDaveyM6924-Jul-08 23:07 
GeneralRe: Killing a byte array? Pin
Luc Pattyn25-Jul-08 3:44
sitebuilderLuc Pattyn25-Jul-08 3:44 
GeneralRe: Killing a byte array? Pin
Luc Pattyn24-Jul-08 9:28
sitebuilderLuc Pattyn24-Jul-08 9:28 
AnswerRe: Killing a byte array? Pin
leppie24-Jul-08 4:33
leppie24-Jul-08 4:33 
GeneralRe: Killing a byte array? Pin
Justin Time24-Jul-08 4:43
Justin Time24-Jul-08 4:43 
QuestionDisable Browser Pin
Agweet24-Jul-08 3:35
Agweet24-Jul-08 3:35 
AnswerRe: Disable Browser Pin
Pete O'Hanlon24-Jul-08 4:00
mvePete O'Hanlon24-Jul-08 4:00 
GeneralRe: Disable Browser Pin
Agweet24-Jul-08 20:22
Agweet24-Jul-08 20:22 

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.