Partager via


So easy it should be illegal

Every once in awhile, I do something in .NET that just makes me love it even more.  If you come from a C++ (and esp. an ATL/COM) background, you'll probably have those moments too.  Here's one that came to me today (note that this project is just a daily exercise and is not an indication that I'm working on some secret MS project that works with web cam images):

using

System;
using System.Drawing;
using System.Net;

namespace

Project.DataLayer
{
      public class WebDataUpdate
{
            public WebDataUpdate(){}

public Image MtStHelensWebCamImage
{
                  get
                  {
                        WebClient client = new WebClient ();
return Image.FromStream(client.OpenRead( "https://www.fs.fed.us/gpnf/volcanocams/msh/images/mshvolcanocam.jpg" ));
                   }
}
}
}

To use it, just create a simple windows form, place a PictureBox control and set its Image property using the MtStHelensWebCamImage property shown above.

Comments

  • Anonymous
    October 13, 2004
    I was just thinking about trying something like this and here it is