Click here to Skip to main content
15,895,192 members
Home / Discussions / C#
   

C#

 
GeneralRe: Why do not save Login file in Server Explorer Pin
Sascha Lefèvre26-Apr-16 5:40
professionalSascha Lefèvre26-Apr-16 5:40 
GeneralRe: Why do not save Login file in Server Explorer Pin
OriginalGriff26-Apr-16 6:32
mveOriginalGriff26-Apr-16 6:32 
QuestionHelp with Listbox and comboBox Pin
Member 1231776424-Apr-16 23:40
Member 1231776424-Apr-16 23:40 
AnswerRe: Help with Listbox and comboBox Pin
koolprasad200324-Apr-16 23:55
professionalkoolprasad200324-Apr-16 23:55 
GeneralRe: Help with Listbox and comboBox Pin
Member 1231776424-Apr-16 23:56
Member 1231776424-Apr-16 23:56 
AnswerRe: Help with Listbox and comboBox Pin
BillWoodruff26-Apr-16 4:04
professionalBillWoodruff26-Apr-16 4:04 
GeneralRe: Help with Listbox and comboBox Pin
Sascha Lefèvre26-Apr-16 5:12
professionalSascha Lefèvre26-Apr-16 5:12 
QuestionHow to get/set SharePoint 2013 MySite properties through API? Pin
Coding Eyes24-Apr-16 23:32
Coding Eyes24-Apr-16 23:32 
AnswerRe: How to get/set SharePoint 2013 MySite properties through API? Pin
Eddy Vluggen25-Apr-16 3:12
professionalEddy Vluggen25-Apr-16 3:12 
QuestionHow to get selected item data of listView Column Item? Pin
0HourCoder23-Apr-16 9:36
0HourCoder23-Apr-16 9:36 
AnswerRe: How to get selected item data of listView Column Item? Pin
Sascha Lefèvre23-Apr-16 9:59
professionalSascha Lefèvre23-Apr-16 9:59 
GeneralRe: How to get selected item data of listView Column Item? Pin
0HourCoder23-Apr-16 10:25
0HourCoder23-Apr-16 10:25 
AnswerRe: How to get selected item data of listView Column Item? Pin
Simon_Whale23-Apr-16 22:24
Simon_Whale23-Apr-16 22:24 
QuestionI have this code that scans the memory of a program, the more programs that precision much memory takes a long time !! Any faster jeito to do this? Pin
Member 1248006323-Apr-16 5:46
Member 1248006323-Apr-16 5:46 
AnswerRe: I have this code that scans the memory of a program, the more programs that precision much memory takes a long time !! Any faster jeito to do this? Pin
OriginalGriff23-Apr-16 5:57
mveOriginalGriff23-Apr-16 5:57 
Questionhow do I get the information from a site of a button? Pin
Member 1248006323-Apr-16 5:12
Member 1248006323-Apr-16 5:12 
QuestionRe: how do I get the information from a site of a button? Pin
CHill6023-Apr-16 5:15
mveCHill6023-Apr-16 5:15 
AnswerRe: how do I get the information from a site of a button? Pin
Member 1248006323-Apr-16 5:28
Member 1248006323-Apr-16 5:28 
AnswerRe: how do I get the information from a site of a button? Pin
OriginalGriff23-Apr-16 5:30
mveOriginalGriff23-Apr-16 5:30 
GeneralRe: how do I get the information from a site of a button? Pin
Member 1248006323-Apr-16 5:35
Member 1248006323-Apr-16 5:35 
GeneralRe: how do I get the information from a site of a button? Pin
CHill6023-Apr-16 5:38
mveCHill6023-Apr-16 5:38 
GeneralRe: how do I get the information from a site of a button? Pin
OriginalGriff23-Apr-16 5:44
mveOriginalGriff23-Apr-16 5:44 
GeneralRe: how do I get the information from a site of a button? Pin
Member 1248006323-Apr-16 5:46
Member 1248006323-Apr-16 5:46 
Questionc# complex dictionary: can modify value in for-loop: thought you couldn't do that Pin
BillWoodruff23-Apr-16 0:10
professionalBillWoodruff23-Apr-16 0:10 
AnswerRe: c# complex dictionary: can modify value in for-loop: thought you couldn't do that Pin
OriginalGriff23-Apr-16 0:24
mveOriginalGriff23-Apr-16 0:24 
It works because you aren't modifying anything the iterator needs to worry about: neither the key nor the value are being modified in any way (since they are a struct you can't change and a reference). You can modify the content of the object the reference "points" to very easily and legally inside the foreach, because you aren't trying to change the values in the collection you are iterating over.
C#
List<MyClass> list = new List<MyClass>();
for (int i = 0; i < 5; i++)
    {
    MyClass mc = new MyClass() { s = i.ToString() };
    list.Add(mc);
    }
foreach (MyClass mc in list)
    {
    mc.s = mc.s + " changed!";
    }
foreach (MyClass mc in list)
    {
    Console.WriteLine(mc.s);
    }

Will give you:
C#
0 changed!
1 changed!
2 changed!
3 changed!
4 changed!
But obviously trying to change the actual value will give you a compilation error:
C#
foreach (MyClass mc in list)
    {
    mc = new MyClass() { s = mc.s + " Changed again!" };
    }

Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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.