Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

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

GeneralRe: c# complex dictionary: can modify value in for-loop: thought you couldn't do that Pin
BillWoodruff23-Apr-16 2:20
professionalBillWoodruff23-Apr-16 2:20 
GeneralOT: Our mutually increasing decrepitude Pin
OriginalGriff23-Apr-16 2:29
mveOriginalGriff23-Apr-16 2:29 
GeneralRe: c# complex dictionary: can modify value in for-loop: thought you couldn't do that Pin
Richard Deeming23-Apr-16 3:39
mveRichard Deeming23-Apr-16 3:39 
QuestionHow to wait to execute for next process till current process complete using C# Process Object Pin
Tej_dev22-Apr-16 5:32
Tej_dev22-Apr-16 5:32 
AnswerRe: How to wait to execute for next process till current process complete using C# Process Object Pin
Richard Deeming22-Apr-16 5:44
mveRichard Deeming22-Apr-16 5:44 
GeneralRe: How to wait to execute for next process till current process complete using C# Process Object Pin
Tej_dev22-Apr-16 6:11
Tej_dev22-Apr-16 6:11 
GeneralRe: How to wait to execute for next process till current process complete using C# Process Object Pin
Tej_dev28-Apr-16 8:56
Tej_dev28-Apr-16 8:56 
GeneralRe: How to wait to execute for next process till current process complete using C# Process Object Pin
Richard Deeming28-Apr-16 9:04
mveRichard Deeming28-Apr-16 9:04 
QuestionC# TableAdapter - Oracle with Identity/Sequence -Column Pin
gpc4421-Apr-16 4:01
gpc4421-Apr-16 4:01 
AnswerRe: C# TableAdapter - Oracle with Identity/Sequence -Column Pin
Dave Kreskowiak21-Apr-16 5:59
mveDave Kreskowiak21-Apr-16 5:59 
QuestionConvert code .Net4.0 to code .Net 2.0 Pin
Member 245846720-Apr-16 17:19
Member 245846720-Apr-16 17:19 
QuestionRe: Convert code .Net4.0 to code .Net 2.0 Pin
DanielBrownAU20-Apr-16 17:48
professionalDanielBrownAU20-Apr-16 17:48 
AnswerRe: Convert code .Net4.0 to code .Net 2.0 Pin
Simon_Whale21-Apr-16 0:57
Simon_Whale21-Apr-16 0:57 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846721-Apr-16 2:42
Member 245846721-Apr-16 2:42 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Dave Kreskowiak21-Apr-16 3:34
mveDave Kreskowiak21-Apr-16 3:34 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Member 245846721-Apr-16 13:19
Member 245846721-Apr-16 13:19 
GeneralRe: Convert code .Net4.0 to code .Net 2.0 Pin
Dave Kreskowiak21-Apr-16 14:29
mveDave Kreskowiak21-Apr-16 14:29 

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.