Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How Can I Assign Multiple Values To Where It Says uint i need to to be from 0 to 18 because im doing something client based a it needs to be done for all 18 clients at once
RPC.doTypeWriter((uint) 0 , (int)numericUpDown21.Value, metroTextBox22.Text, (short)numericUpDown23.Value, (double)numericUpDown24.Value, (float)numericUpDown25.Value, (float)numericUpDown26.Value, (ushort)numericUpDown35.Value, (ushort)numericUpDown36.Value, (ushort)numericUpDown37.Value, (int)numericUpDown27.Value, (int)numericUpDown28.Value, (int)numericUpDown29.Value, (int)numericUpDown30.Value, (int)numericUpDown31.Value, (int)numericUpDown32.Value, (int)numericUpDown33.Value, (int)numericUpDown34.Value);
You can't. An uint is a single integer value, it can't hold multiple values.
Use a loop to loop from 0 to 17 (as that is 18 clients):
for (uint i = 0; i < 18; i++) {
RPC.doTypeWriter(i, (int)numericUpDown21.Value, metroTextBox22.Text, (short)numericUpDown23.Value, (double)numericUpDown24.Value, (float)numericUpDown25.Value, (float)numericUpDown26.Value, (ushort)numericUpDown35.Value, (ushort)numericUpDown36.Value, (ushort)numericUpDown37.Value, (int)numericUpDown27.Value, (int)numericUpDown28.Value, (int)numericUpDown29.Value, (int)numericUpDown30.Value, (int)numericUpDown31.Value, (int)numericUpDown32.Value, (int)numericUpDown33.Value, (int)numericUpDown34.Value);
}
The naming suggests that you are doing RPC calls to the clients, so you might need to move more code into the loop, e.g. doing the connection to each client in the loop.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Will the C# function Convert.ToInt32(text) convert different words to the same int? Any links or pushes in the right direction are appreciated!
P.S.
What about anagrams?
No, Convert.ToInt32(text) will just try to parse your text to an int, like:
Convert.ToInt32("032") will return 32 as int but
Convert.ToInt32("Brian") will throw an exception.
I assume that you want to have some kind of hashing, when you say "different words to the same int".
Try GetHashCode(). It will return the same value if you call it multiple times with the same value, for example:
"Brian".GetHashCode() will always return 1635321435
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to add numbers to the total value of an int cell instead of set its value? Correctly I'm using a list and I and things are getting weird.. the list is <int> list and its value is jumping into random numbers without any reason. I think that changing the count type (from list into int) will solve it. (c#. visual studio 2013).
Doesn't look so hard to me...?
int variable = 10; // start with 10 points
variable++; // add 1
variable += 3 // add 3
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Let's say we need to output 1000 # symbols in one line without loops or recursion. And surely without making a line of code with 1000 chars there.
The noob solution that comes to mind is...
string s = "#";
s = s+s+s+s+s+s+s+s+s+s;
s = s+s+s+s+s+s+s+s+s+s;
s = s+s+s+s+s+s+s+s+s+s;
Console.WriteLine(s);
Are there any others?
var repeatedString = new string('#', 1000);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Suppose you have a parallel loop in C# and want to use : Interlocked.Increment
Also, suppose there is a heavy process in your loop. Do you think putting Interlocked.Increment before or after that heavy process might make any difference?
In other words, which of the followings is more preferred?
UPDATE: Suppose our criterion for being better or worse is the overall speed.
Prog1:
int iter = 0;
Parallel.For(...{
HeavyProcess()
Interlocked.Increment(iter);
});
Prog2:
int iter = 0;
Parallel.For(...{
Interlocked.Increment(iter);
HeavyProcess()
});
The "one that is preferred" is simply: the one that is functionally correct. Is it meant to record the number of complete operations (end)? or the number of started operations (beginning). Other than that: no difference.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How do i create a six digit sequence number in c# ?
Is there any other way than storing a string in the database like "000000" and later on incrementing it through the last inserted value ?
Use a plain old number as a sequence, this is what your DB will provide. If you want to display it with six digits, just call: yourNumber.ToString("D6")
(see docs)