|
If you're calling them sequentially, what's the point?
|
|
|
|
|
It's my fault.
I have explain properly.
Basically What I want
In my program, two thread running.
Both thread taking method Name from Array and and executing.
Array containning Method Name List.
Only method name from the Array.
problem is when i m assigning like this i m getting error.
Error "strMN is a Variable but it's used like Method"
strMN getting value from the Array.
strMN is Variable Name.
Code :-
string[] strMName = strMethodName.ToString().Split(' ');
Console.WriteLine("Thread running");
for (int i = 0; i < strMName.Length; i++)
{
string strMN = strMName[i].ToString();
// create a thread for the Incrementer
Thread trdIncrementer = new Thread(new ThreadStart(strMN));
trdIncrementer.Start();
// create a thread for the Decrementer.
Thread trdDecrementer = new Thread(new ThreadStart(strMN));
trdDecrementer.Start();
}
Error "strMN is a Variable but it's used like Method"
Methods:-
///
/// demo function for Incrementer, counts up to 10.
///
public void Incrementer()
{
lock (trdIncrementer )
{
for (int counter = 0; counter < 10; counter++)
{
// assign the incrementer value and display the results
Console.WriteLine("Incrementer: {0}", counter);
}
}
}
///
/// demo function for Decrementer, counts down from 10.
///
public void Decrementer()
{
lock (trdDecrementer)
{
for (int counter = 10; counter >= 0; counter--)
{
// assign the decremented value and display the results
Console.WriteLine("Decrementer: {0}", counter);
}
}
}
help me out .
It's arrgent.
Thanks
|
|
|
|
|
I have two thread.
I have more than one method in the array.
I want Two thread should run side by side.
and execute methods.
Suppopse array contains four method name:
1.A
2.B
3.C
4.D
So,
First thread take A method name from the array.
Second thread take B method name from the array.
Once Any of these two thread comleted their task then it has to take next C
method from the array....
Example:-
if suppose 1st thread complete before 2nd thread. it' should take 3rd method name then 2nd thread should not take 3rd method name from the array. it should take 4th method name from the array.
Thanks
|
|
|
|
|
You may want to study some on threads and synchronization for your solution. However I may be wrong because:
asif_aslam wrote: First Thread reading Method from XML file and starting the 1st Thread.
First thread starts the first thread? I am pretty sure that cannot happen.
and...
asif_aslam wrote: Onec which ever thread complete method it's takes next method.
We have a communication breakdown because I have no idea what that means.
led mike
|
|
|
|
|
It's my fault.
I have explain properly.
Basically What I want
In my program, two thread running.
Both thread taking method Name from Array and and executing.
Only method name from the Array.
problem is when i m assigning like this i m getting error.
strMN is Variable Name.
strMN getting it's value from the Array.
like this.
string strMN = strMName[i].ToString();
Thread trdIncrementer = new Thread(new ThreadStart(strMN));
Error :-> "strMN is a Variable but it's used like Method"
help me out .
It's arrgent.
Thanks
|
|
|
|
|
I have two thread.
I have more than one method in the array.
I want Two thread should run side by side.
and execute methods.
Suppopse array contains four method name:
1.A
2.B
3.C
4.D
So,
First thread take A method name from the array.
Second thread take B method name from the array.
Once Any of these two thread comleted their task then it has to take next C
method from the array....
Example:-
if suppose 1st thread complete before 2nd thread. it' should take 3rd method name then 2nd thread should not take 3rd method name from the array. it should take 4th method name from the array.
Thanks
|
|
|
|
|
asif_aslam wrote: string strMN = strMName[i].ToString();
Thread trdIncrementer = new Thread(new ThreadStart(strMN));
If you are trying to execute different operations in threads using configuration information (data) you are going about it all wrong. Implementing that does not require multiple thread methods.
led mike
|
|
|
|
|
Hi all
I'm new in C# development.
I've got a function with a parameter of type object that is casted to a string to be used in it.
How to test a variable before passing it to the function? There is some function making sure that a variable I'm using is a string. What checking to do?
I need to use it also with assertion in debug code.
Regards
manuStone
|
|
|
|
|
2 ways depending on how you want to play it
if(myUnknownObject is string)
{
string myString = (string)myUnknownObject;
DoStuff(myString);
}
or
string myString = myUnknownObject as string;
DoStuff(myString);
the second way will leave myString as null if myString wasn't a string so you'll have to check for nulls in DoStuff, but you'd do that anyway as a string could be null. The difference is whether a null string has a significance in your application.
HTH
Russell
|
|
|
|
|
Hi Russel
thank you very much for your quick response.
Have a nice day
manuStone
|
|
|
|
|
Additional to arachnoids second solution you may also do this:
if(obj is string)
DoStuff((string)obj);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I've got a WebBrowser control and when I do a:
browser.Navigate("http://some.url")
it will work fine the first time, but a subsequent call to the same URL will ALWAYS return instantly with the locally cached copy... when what I really want it to do is a complete new download.
How do I force browser.Navigate to ignore the local system cache??
Just for grins, I tried setting:
browser.Refresh(WebBrowserRefreshOption.Completely)
just after the InitializeComponent method, hoping it would force the control to bypass the cache, but it didn't (and according to the documentation, this just does a refresh and doesn't set the DocumentCompleted event anyway...) but I couldn't find anything else that might bypass the cache and force a reload.
What am I missing?
Thanks!
-Dan
|
|
|
|
|
|
Excellent suggestion... not sure why I didn't think of it... . Not real elegant, but works perfectly! Thanks for the tip and quick reply!
-Dan
|
|
|
|
|
Hi everybody! I want to read memory and pin information of smartphone or PDA but i don't know what function can be used in C#. I found in MSDN but it in Visual C++. Now i wonder either i can do it in C# or not. Please help me!
Thank.
|
|
|
|
|
Hi All,
Here i want to execute an .exe file on particular button. Plz hlep
Regards:
Suveen
|
|
|
|
|
Process.Start(string exeName); is probably the best way. I can't remember the namespace, but it's probably in System.Diagnostics
|
|
|
|
|
PRocess.Start will start any exe for you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I need to add motion blur effect to my image. Did anyone know the code for this in c#.
Thanks
|
|
|
|
|
This article might help (as a starting point).
http://www.codeproject.com/opengl/MotionBlur.asp[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I have seen that code .But it is in c++.
|
|
|
|
|
My image processing libraries are in C sharp. You should be able to read those, and this article, and work out how to port the code. Then, you can write your own article ç'=
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Motion blur is an efect obtaind by exposing a moving object to a reciver for a longer period of time, in witch the object changes it's position.
So, if your image is static and you want to generate a "blurred" version of it I wold recommend you to add to a new ARGB image the original one and with an different alpha value the same image with different displacements, depending on the desired effect. Suposing you want the image to look like moving in a line you would and a sequence of alpha images at diferent y (or x) coordinates (depending on the "speed"). Or for instance if you want your immage to look like an "earth-quake" one, do like in the line instance, but in the + and - direction of the x coordinate (or the floor line).
I hope this helps.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
How do i detect if windows is using themes or classic mode?
I'm building a control which needs to have 2 comboboxes touching each other(or nearly). If I make them touch in my development environment(windows classic) then they overlap under XP styles. If I make them touch in XP styles there are huge gaps in Windows Classic.
Is there an easy way to find out which mode i'm in or what the drawable area of the control is?
Thanks
Russ
|
|
|
|
|