I am a newbie for c# I want to know how I download images by URL in my XML file. Now, I am writing the code for reading XML
using (XmlReader xmlReader = XmlReader.Create(pathXml))
{
while (xmlReader.Read())
{
if (xmlReader.IsStartElement())
{
switch (xmlReader.Name)
{
case "id":
string id = xmlReader.ReadString();
Console.WriteLine("id "+id);
break;
case "url":
string url = xmlReader.ReadString();
Console.WriteLine("url "+url);
break;
}
}
}
Add more detail after trying to do but I am stuck again
using (MemoryStream mem = new MemoryStream(data))
{
using (var yourImage = Image.FromStream(mem))
{
yourImage.Save("Image2.png", ImageFormat.Png);
}
}
in line using(var yourImage = Image.FromStream(mem)) it's show Exception Unhandled System.ArgumentException: 'Parameter is not valid' What should I do ?? Please help me
FYI: the URL in data is an image without format in Website that must be log-in user and password