req.AllowAutoRedirect = false;
string data;
Dictionary<string, string> head = new Dictionary<string, string>();
- HttpStatusCode ret = GetResponse(req, out data, head);
+ GetResponse(req, out data, head);
string location;
return head.TryGetValue("Location", out location)
public Image GetImage(Uri url)
{
- return GetImage(url.ToString());
+ return GetImage(url.AbsoluteUri);
}
public Image GetImage(string url)
}
catch (Exception)
{
- if (bmp != null)
- {
- bmp.Dispose();
- bmp = null;
- }
+ bmp?.Dispose();
bmp = new Bitmap(width, height);
bmp.Tag = img.Tag;
}
finally
{
- if (bmp != null) bmp.Dispose();
+ bmp?.Dispose();
img.Dispose();
}
}