且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用静态或类的应用程序

更新时间:2023-11-22 21:44:10

为什么需要一次加载所有数千张图像?为什么不根据需要选择每个人呢?我认为您提出的问题不是正确的.您正在尝试寻找一种使用静态类进行证明的方法.但是问题应该是,您需要什么样的方案才能加载所有图像.在任何情况下我都看不到.

如果图像存储在单个位置,并且您有与数据库中特定行关联的图像,则使用该行的ID和图片名称.使用字典可了解需要时要拉出的图像.
Why do you need to load all thousand images at once? Why not take each one on a needed basis? I don't think you are asking the right question. You are trying to seek a way to justify using a static class. But the question should be, what is your scenario that would require you to load all images. I cannot see this in any scenario.

If the images are stored in in a single location and you have an image associated with a particular row in a database, then create a Dictionary using the ID of the row and the name of the image. Use the dictionary to know which image to pull out when you need it.