Click here to Skip to main content
15,888,527 members
Home / Discussions / C#
   

C#

 
GeneralRe: combobox in c# Pin
Member 102635197-Nov-13 22:03
Member 102635197-Nov-13 22:03 
GeneralRe: combobox in c# Pin
CodeBlack7-Nov-13 22:07
professionalCodeBlack7-Nov-13 22:07 
GeneralRe: combobox in c# Pin
Member 102635197-Nov-13 22:28
Member 102635197-Nov-13 22:28 
GeneralRe: combobox in c# Pin
CodeBlack7-Nov-13 21:38
professionalCodeBlack7-Nov-13 21:38 
AnswerRe: combobox in c# Pin
Bernhard Hiller7-Nov-13 21:16
Bernhard Hiller7-Nov-13 21:16 
QuestionCannot evaluate expression because a native frame is on top of the call stack Pin
josephdalebert7-Nov-13 3:17
josephdalebert7-Nov-13 3:17 
AnswerRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
Alan Balkany7-Nov-13 4:40
Alan Balkany7-Nov-13 4:40 
GeneralRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
josephdalebert7-Nov-13 5:22
josephdalebert7-Nov-13 5:22 
GeneralRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
Alan Balkany7-Nov-13 5:25
Alan Balkany7-Nov-13 5:25 
GeneralRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
josephdalebert7-Nov-13 5:41
josephdalebert7-Nov-13 5:41 
GeneralRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
Alan Balkany7-Nov-13 5:45
Alan Balkany7-Nov-13 5:45 
GeneralRe: Cannot evaluate expression because a native frame is on top of the call stack Pin
josephdalebert7-Nov-13 6:05
josephdalebert7-Nov-13 6:05 
QuestionCustom configuration in app.config Pin
Member 102635196-Nov-13 23:29
Member 102635196-Nov-13 23:29 
AnswerRe: Custom configuration in app.config Pin
Abhinav S7-Nov-13 0:13
Abhinav S7-Nov-13 0:13 
GeneralRe: Custom configuration in app.config Pin
Member 102635197-Nov-13 0:48
Member 102635197-Nov-13 0:48 
AnswerRe: Custom configuration in app.config Pin
Abhinav S7-Nov-13 0:57
Abhinav S7-Nov-13 0:57 
GeneralRe: Custom configuration in app.config Pin
Member 102635197-Nov-13 1:19
Member 102635197-Nov-13 1:19 
GeneralRe: Custom configuration in app.config Pin
Dave Kreskowiak7-Nov-13 1:29
mveDave Kreskowiak7-Nov-13 1:29 
GeneralRe: Custom configuration in app.config Pin
Member 102635197-Nov-13 19:58
Member 102635197-Nov-13 19:58 
AnswerRe: Custom configuration in app.config Pin
Richard MacCutchan7-Nov-13 0:53
mveRichard MacCutchan7-Nov-13 0:53 
QuestionC# code to fetch all attributes of an element Pin
AshwiniSH6-Nov-13 23:09
professionalAshwiniSH6-Nov-13 23:09 
AnswerRe: C# code to fetch all attributes of an element Pin
Pete O'Hanlon6-Nov-13 23:41
mvePete O'Hanlon6-Nov-13 23:41 
AnswerRe: C# code to fetch all attributes of an element Pin
Abhinav S7-Nov-13 0:15
Abhinav S7-Nov-13 0:15 
QuestionHow to perform file transfer using SFTP using Genymed SSH2 dll in dot net Pin
superselector6-Nov-13 23:08
superselector6-Nov-13 23:08 
Questionvolatile Pin
devvvy6-Nov-13 19:35
devvvy6-Nov-13 19:35 
how come adding "volatile" in below code snippet didn't help?

The output, without "volatile" would be like:
m=1,000,000, n=999,993

My expectation was, m=n=1,000,000 exactly if I added "volatile".

<br />
using System;<br />
using System.Collections;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Threading;<br />
using System.Threading.Tasks;<br />
<br />
namespace SimpleConsole<br />
{<br />
    class Test<br />
    {<br />
        static int i = 0;<br />
        <br />
        static volatile int n = 0;<br />
        static int m = 0;<br />
<br />
        static Object SyncRoot = new Object();<br />
<br />
        static void Main(string[] args)<br />
        {<br />
            Task[] Tasks = new Task[100];<br />
<br />
            try<br />
            {<br />
                n = 0;<br />
                m = 0;<br />
                for (i = 0; i < 100; i++)<br />
                {<br />
                    Task t = new Task(<br />
                        () =><br />
                        {<br />
                            for (int j = 0; j < 1000000; j++)<br />
                            {<br />
                                n++; // no lock<br />
<br />
                                lock (SyncRoot)<br />
                                {<br />
                                    m++;<br />
                                }<br />
                            }<br />
                        }<br />
                    );<br />
<br />
                    Tasks[i] = t;<br />
<br />
                    t.Start();<br />
                }<br />
<br />
                Task.WaitAll(Tasks);<br />
                Console.WriteLine("n=" + n + ", m=" + m);<br />
<br />
                Console.WriteLine("Hit any key to exit");<br />
                Console.ReadLine();<br />
            }<br />
            catch (Exception Ex)<br />
            {<br />
                Console.WriteLine("Error in main: " + Ex.Message);<br />
            }<br />
<br />
            return;<br />
        }<br />
    }<br />
}<br />

dev

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.