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

C#

 
AnswerRe: Disable PDF Print button from C# Pin
Vasudevan Deepak Kumar23-Nov-07 3:42
Vasudevan Deepak Kumar23-Nov-07 3:42 
GeneralRe: Disable PDF Print button from C# Pin
cosmoteco23-Nov-07 4:33
cosmoteco23-Nov-07 4:33 
GeneralRe: Disable PDF Print button from C# Pin
Dave Kreskowiak23-Nov-07 5:31
mveDave Kreskowiak23-Nov-07 5:31 
GeneralRe: Disable PDF Print button from C# Pin
cosmoteco23-Nov-07 5:43
cosmoteco23-Nov-07 5:43 
Question.NET 2.0 Remoting Listener - Adding a Telnet connection message [modified] Pin
MrEyes23-Nov-07 2:58
MrEyes23-Nov-07 2:58 
QuestionInteroperatablity between managed and unmanaged code Pin
mastermind.aj23-Nov-07 2:04
mastermind.aj23-Nov-07 2:04 
AnswerRe: Interoperatablity between managed and unmanaged code Pin
Pete O'Hanlon23-Nov-07 2:10
mvePete O'Hanlon23-Nov-07 2:10 
QuestionSynchronizing Collections Pin
hamidkhan23-Nov-07 1:53
hamidkhan23-Nov-07 1:53 
I have been trying to work out a synchronization mechnaism in C# using syncroot property of collections. I used a StringCollection class as an example to see what will happen in my code. Here is my Console application code:

namespace synctest
{
class Program
{
static StringCollection mycol = new StringCollection();

static void Main(string[] args)
{
for (int i = 0; i < 1000; i++)
{
mycol.Add(i.ToString());
}
Thread t1 = new Thread(Disp);
Thread t2 = new Thread(Manip);
t1.Start();
Thread.Sleep(10);
t2.Start();
Console.ReadLine();
}

static void Disp()
{
lock (mycol.SyncRoot)
{
for (int i = 0; i < 1000; i++)
{
Console.Write(mycol[i] + "-");
}
}
}
static void Manip()
{
for (int i = 0; i < 1000; i++)
{
mycol[i] = (i*2).ToString();
}
}
}
}
One thread displays the collection items while the other one tries to multiply the integer representation of each itme by 2. In my test, I expected the multiplier thread to wait for the first thread to finish its job, but i noticed that after number 20, all the displayed numbers were multiplied by 2. This means that the threads have overlapped and although I have used lock on the collection's syncroot property, the problem of concurrency still happens. Any clue?
AnswerRe: Synchronizing Collections Pin
Bekjong23-Nov-07 2:09
Bekjong23-Nov-07 2:09 
QuestionDropDownList Pin
minniemooo23-Nov-07 1:30
minniemooo23-Nov-07 1:30 
AnswerRe: DropDownList Pin
Andrei Ungureanu23-Nov-07 1:44
Andrei Ungureanu23-Nov-07 1:44 
QuestionItemmouseoverevent in listview Pin
anu8123-Nov-07 1:24
anu8123-Nov-07 1:24 
AnswerRe: Itemmouseoverevent in listview Pin
anu8123-Nov-07 1:46
anu8123-Nov-07 1:46 
QuestionProgress bar working on button click Pin
D i x y23-Nov-07 1:04
D i x y23-Nov-07 1:04 
AnswerRe: Progress bar working on button click Pin
Andrei Ungureanu23-Nov-07 1:09
Andrei Ungureanu23-Nov-07 1:09 
AnswerRe: Progress bar working on button click Pin
Xmen Real 23-Nov-07 1:54
professional Xmen Real 23-Nov-07 1:54 
QuestionUPS Integration in asp.net 2.0 (C#) Pin
Saviaq23-Nov-07 0:51
Saviaq23-Nov-07 0:51 
AnswerRe: UPS Integration in asp.net 2.0 (C#) Pin
Dave Kreskowiak23-Nov-07 5:28
mveDave Kreskowiak23-Nov-07 5:28 
GeneralRe: UPS Integration in asp.net 2.0 (C#) Pin
KevinEarley17-Jul-12 13:13
KevinEarley17-Jul-12 13:13 
GeneralRe: UPS Integration in asp.net 2.0 (C#) Pin
Dave Kreskowiak17-Jul-12 16:27
mveDave Kreskowiak17-Jul-12 16:27 
QuestionSelect an item in a listview Pin
Lucy23-Nov-07 0:24
Lucy23-Nov-07 0:24 
AnswerRe: Select an item in a listview Pin
mav.northwind23-Nov-07 0:51
mav.northwind23-Nov-07 0:51 
GeneralRe: Select an item in a listview Pin
Lucy23-Nov-07 1:12
Lucy23-Nov-07 1:12 
QuestionHelp in form cpu Utilisation Pin
superda23-Nov-07 0:23
superda23-Nov-07 0:23 
AnswerRe: Help in form cpu Utilisation Pin
Bekjong23-Nov-07 1:17
Bekjong23-Nov-07 1:17 

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.