When I first started using monotouch, I found a page with some code samples for simple and frequent tasks ... but on some of these code samples I found a few things like this:
var imageRect = new RectangleF(0f, 0f, 320f, 109f);
using (var myImage = new UIImageView(imageRect))
{
myImage.Image = UIImage.FromFile("myImage.png");
myImage.Opaque = true;
view.AddSubview(myImage);
}
UIImageView is created inside the using () block.
I am a .Net developer and I know what use () does, but I don't understand why it is used in this example. So my question is whether this is the best way to create views and what are the differences (if any) of this approach and creating views without using () block.
source
share