I have tried for days, and I cannot find a solution that explains/fits into the mess I have committed myself to.
VS 2017 C#.NET.
I have a textBox (entryBox) which feeds a prefix and a decimal into a listBox (list1), one pair at each button.Click. A foreach()-statement separates prefix and decimal, and saves decimal to a decimal-list (plaAmounts).
I wish to add up all decimals on that list, but cannot find a working way to do so. All my last textBox displays, is the most recently added decimal. Any suggestions?
class
{
private void buttonClick
{
list1.Items.Add(entryBox.Text);
for (int i = 0; i < list1.Items.Count; i++)
{
. string itemText = list1.Items.ToString();
. var plaAmounts = new List<decimal>();
.
. if (itemText.Contains("pla"))
. {
. . list1.SetSelected(i, true);
. . foreach (Object selecteditem in list1.SelectedItems)
. . {
. . . string[] substrings = itemText.Split(',');
. . . string plaNumberText = substrings[1];
. . . decimal plaNumber = Convert.ToDecimal(plaNumberText);
Exactly what I was going to say, lmao. Pro-grade where? I have the S24 Ultra and there are only marginal differences between that series and the S25 series. Hell, even the S23 and S22 series is similar. Samsung stopped trying years ago.
A 10% IPC boost is underwhelming for what is supposed to be a major generational leap. Unless it's accompanied by higher clock speeds, or the IPC boost is greater than 10% in games, I'm not sure that it will be enough to compete with Zen 5 X3D, let alone Zen 6 X3D for gaming.
Single-core performance is super important and cannot be compensated with more cores, whereas the reverse is true, you can compensate for fewer cores with better single-core performance.
Question
reap123
Hi,
I have tried for days, and I cannot find a solution that explains/fits into the mess I have committed myself to.
VS 2017 C#.NET.
I have a textBox (entryBox) which feeds a prefix and a decimal into a listBox (list1), one pair at each button.Click. A foreach()-statement separates prefix and decimal, and saves decimal to a decimal-list (plaAmounts).
I wish to add up all decimals on that list, but cannot find a working way to do so. All my last textBox displays, is the most recently added decimal. Any suggestions?
class
{
private void buttonClick
{
list1.Items.Add(entryBox.Text);
for (int i = 0; i < list1.Items.Count; i++)
{
. string itemText = list1.Items.ToString();
. var plaAmounts = new List<decimal>();
.
. if (itemText.Contains("pla"))
. {
. . list1.SetSelected(i, true);
. . foreach (Object selecteditem in list1.SelectedItems)
. . {
. . . string[] substrings = itemText.Split(',');
. . . string plaNumberText = substrings[1];
. . . decimal plaNumber = Convert.ToDecimal(plaNumberText);
. . . plaAmounts.Add(plaNumber);
. . }
. }
. decimal plaTotals = plaAmounts.Sum();
. plaBox.Clear();
. plaBox.AppendText(plaTotals.ToString());
}
}
}
Link to comment
https://www.neowin.net/forum/topic/1328832-need-help-summing-up-list-of-decimals/Share on other sites
2 answers to this question
Recommended Posts