

List = dynamicke zaplneni promenne tridy MediaElement
Pomoci cyklu for, bych potreboval vytvorit 6 promennych tridy MediaElement. Nevi nekdo jak na to? Predem dekuji za odpoved!
List<MediaElement> mediaElements = new List<MediaElement>();
for (int i = 1; i < 6; i i++)
{
mediaElements.Add(??????????????????);
}
Potrebuji vytvorit:
MediaElement soundPlay1 = new MediaElement();
MediaElement soundPlay2 = new MediaElement();
MediaElement soundPlay3 = new MediaElement();
MediaElement soundPlay4 = new MediaElement();
MediaElement soundPlay5 = new MediaElement();
MediaElement soundPlay6 = new MediaElement();
Zkousel jsem: mediaElements.Add(mediaElements.Format("name{0}", i.ToString()), i);
Ale nefunguje to
Místo otazníku:
new MediaElement()