I have file of such data:
- 2016-07-01 - this is data
- 39
- 40
- 36
- 37
- 40
- 37
I want to count each elements in my array. For example: 10, 2, 2, 2, 2, 2, 2. How do that?
string FilePath = @"path";
int counteachelement = 0;
string fileContent = File.ReadAllText(FilePath);
string[] integerStrings = fileContent.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
for (int n = 0; n < integerStrings.Length; n++)
{
counteachelement = integerStrings.GetLength(n);
Console.Write(counteachelement + "\n");
}