Click here to Skip to main content
15,892,537 members
Home / Discussions / C#
   

C#

 
AnswerRe: Bitwise Circular Shift in C# Pin
Ennis Ray Lynch, Jr.24-Jul-08 12:15
Ennis Ray Lynch, Jr.24-Jul-08 12:15 
GeneralRe: Bitwise Circular Shift in C# Pin
Ian Uy25-Jul-08 16:05
Ian Uy25-Jul-08 16:05 
Questionhow to "copy local dependencies" in C# !? Pin
Skeletor2324-Jul-08 4:21
Skeletor2324-Jul-08 4:21 
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 
Hi,

I have encountered a very strange problem.

I have a stuct that has a string variable inside.

I'm creating a list of the Struct's type, and try to assign the string variable.
this doesn't work !!!
but If I create a Class instead of a struct this work!!

The Struct:
public struct Struct1
{
    private string s;
    public Struct1(string d)
    {
        s = "";
    }
    public void SetS(string i) { s = i; }
    public string GetS() { return s; }
}


The Class:
class myStr
{
    private string s;
    public myStr(){}
    public void SetS(string i) { s = i; }
    public string GetS() { return s; }
}


The Main:
static void Main(string[] args)
{
    List<Struct1> ls = new List<Struct1>();
    Struct1 str = new Struct1("f");
    ls.Add(str);
    ls[0].SetS("hi");
    string mys = ls[0].GetS();
    Console.WriteLine("mys: " + mys);

    List<myStr> ls2 = new List<myStr>();
    myStr str2 = new myStr();
    ls2.Add(str2);
    ls2[0].SetS("hello");
    string mys2 = ls2[0].GetS();
    Console.WriteLine("mys2: " + mys2);
}


The output is:
mys:
mys2: hello

this seems very strange!
I would be very happy if someone has an explanation.

Thanks.
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 
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 

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.