So i am making a mailfunction and im having an issue showing the data the way i want it to show.
This is my code(editted to show only the issue im having):
public string Formatsfunction(List<Metadata> mmds)
{
Dictionary<string, int> formatNumber = new Dictionary<string, int>();
foreach (Metadata mmd in mmds)
{
var type = mmd.Format.Type;
var found = formatNumber.ContainsKey(type);
if (found == true)
{
formatNumber[type]++;
}
else
{
formatNumber[type] = 1;
}
}
Console.WriteLine();
return null;
}
private string MeldingInformatie(string impact, string type, List<Metadata> mmds)
{
var temp = Formatsfunction(mmds);
var formats = mmds.Select(mmd => mmd.Format.Type +"("+temp+")");
...
}
What i want it to do is:
If there are multiple of the same types in the Dictionary write it like:
Lion(3) Bear(2) Fish(8) Koala(12) etc.
I think i already got a good start going but am not sure what to do next.
Thanks for the help guys! Combining all the knowledge you guys have given me i fixed the problem. For those interested the answer was: