I have found i can make an array of my classes.
But when i try to add picture to my layout Root, it doesn't seem to work if i use a class.
This works
public Image myPicture= new Image();
LayoutRoot.Children.Add(myPicture);
But this doesnt work. Why?
public Image[] myPicture= new Image[2];
LayoutRoot.Children.Add(myPicture[0]);
Any help would be great, i know i can use list for this, but i relly want to use arrays if possible.
Note: i am decently knew to c# and silver light, classes and objects are some what new to me. but i think i am getting it.
Loading
AlanPosted Aug 31, 2008, 5:58 AM
The reason it doesn't work is because, although you've created your Image array, you haven't actually added any Image objects to it and so all the elements are null!
Try it like this instead:
public Image[] myPicture= new Image[2] {new Image(), new Image()};
LayoutRoot.Children.Add(myPicture[0]);
KieraPosted Jul 24, 2024, 1:00 PM
Interesting discussion on handling arrays of classes in C# and Silverlight! The tips provided are quite useful for managing complex data structures. For those interested in improving their career prospects alongside honing their coding skills, check out [url=https://www.resumefolks.com/]Resume Folks[/url] for expert resume and career services. Keep up the great work, everyone!