|
using System;
using System.Collections;
namespace GameList {
public class StatsCounter {
private ArrayList tbl;
public StatsCounter() {
tbl = new ArrayList();
}
public void Add(string text) {
bool found = false;
foreach (Stat st in tbl) {
if (st.Text.Equals(text)) {
found = true;
st.Count++;
found = true;
break;
}
}
if (!found) {
Stat s = new Stat(text, 1);
tbl.Add(s);
}
}
public Stat this[int i] {
get { return (Stat)tbl[i]; }
}
public int Count {
get { return tbl.Count; }
}
}
public class Stat {
private string text;
private int count;
public Stat(string text, int count) {
this.text = text;
this.count = count;
}
public string Text {
get { return text; }
set { text = value; }
}
public int Count {
get { return count; }
set { count = value; }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I've been in software development for more than a decade now. Originally with ASP 2.0 and VB6. I worked in Japan for a year doing Java. And have been with C# ever since.
In 2005 I founded
BoneSoft Software where I sell a small number of developer tools.