locked
what is return type for displaying the list of image in C# RRS feed

  • Question

  • User-1722422105 posted

    Hi all

    below the web api code

    public List<System.Drawing.Image> getimage_folder()
    {
    System.Drawing.Image img=null;

    string[] filePaths = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/images"));
    List<System.Drawing.Image> imgfile = new List<System.Drawing.Image>();


    foreach (string filePath in filePaths)
    {
    string fileName = Path.GetFileName(filePath);


    // files.Add(new ListItem(fileName, "~/Images/" + fileName));
    // img.Save(filePath);
    // Bitmap image1 = (Bitmap)System.Drawing.Image.FromFile(filePath, true);

    System.Drawing.Image image1 = (System.Drawing.Image)System.Drawing.Image.FromFile(filePath, true);
    imgfile.Add(image1);


    }


    return imgfile;
    }

    i am not getting the list of image, instead i am geting  system.image  like

    what is return type for geting the image

    Monday, June 11, 2018 6:11 AM

All replies

  • User-330142929 posted

    Hi Sidu,

    i am not getting the list of image, instead i am geting  system.image  like

    According to your description, I am not clear that what your real needs are. Where the function getimage_folder() you use at, and for what? Are you implementing an API to present a list of pictures, and want to know how to handle with System.Draw.Image class?

    It is easily to give you more effective solution If you could describe your needs clearly.

    Look forward to your reply.

     

    Best Regards,

    Abraham

    Tuesday, June 12, 2018 9:43 AM