I've inherited from PictureBox and I have a lot of custom Properties set in place. One thing that I've grown intolerant of lately is the fact that I must always specify manually, each and every Property that I wish to output to the Console (to see its value, if any).
An example:
public class Picture : PictureBox
{
public int Id { get; set; }
public class PictureProperties
{
public string Name { get; set; }
public string Extension { get; set; }
public string Credits { get; set; }
public Size DesignTimeSize { get; set; }
public Point DesignTimePoint { get; set; }
}
public PictureProperties Properties { get; set; }
}
Usage:
public void test()
{
SortedList<int, JTS.Picture> list = new SortedList<int, JTS.Picture>();
for(int i = 0; i < 10; i++)
{
list.Add(1, new Picture()
{
Id = 1,
Properties = new Picture.PictureProperties()
{
Name = "Travis",
Credits = "people here"
},
Thumbnail = new Picture.PictureThumbnail()
{
Size = new Size(250, 250)
}
});
}
}
What I would like to do is, inside that foreach
loop:
Console.WriteLine(Picture); and it will automagically output all of the properties contained within the Picture control. i.e. Name, Id, PictureProperties and its properties, Size, Location, absolutely everything. If you type, myNewPicture.
intellisense will give you a list of all properties. That's what I want. All of that. In the console (or in a variable/string to output to file).
Is there a way to do this?