首页 \ 问答 \ 如何迭代C#中的类的实例?(How do I iterate through instances of a class in C#?)

如何迭代C#中的类的实例?(How do I iterate through instances of a class in C#?)

有没有办法在C#中迭代一个类的实例? 这些实例不会在集合中进行跟踪或管理。


Is there a way to iterate over instances of a class in C#? These instances are not tracked or managed in a collection.


原文:https://stackoverflow.com/questions/1786083
更新时间:2021-12-06 21:12

最满意答案

关注点1:内存限制

readfile流,因此它被动态地转换为HTTP响应,并且不会被加载到完成的内存中。

但是,对于上传,脚本必须具有足够的内存,因为在上传和使用PHP时,如果我没有记错,整个文件就会进入内存。

关注点2:最大执行时间

如果您担心安全问题,请通过HTTPD服务器处理认证和访问权限。 然后,当请求无效时,您的脚本将不会执行。


Concern 1: Memory Limits

readfile streams, so this is converted into the HTTP response on the fly and it won't be loaded into memory completed.

For uploads however, the script must have enough memory because while uploading and using PHP the whole file goes into memory if I remember right.

Concern 2: Max Execution Time

If you're concerned about security, handle authentication and access rights already via the HTTPD server. Then your script won't be executed when the request is not valid.

相关问答

更多
  • Java小程序怎么样? 这就是我以前在一家公司做过的事情。 我知道小程序很烂,特别是在这个日子里,我们可以使用所有的选项,但是它们真的是在网页开发中遇到的桌面式问题最通用的解决方案。 只要考虑一下 How about a Java applet? That's how we had to do it at a company I previously worked for. I know applets suck, especially in this day and age with all our op ...
  • 结果是一个404.15错误的问题 - 查询字符串太长而且很多巧合投入了很好的措施。 Turned out to be an issue with a 404.15 error - querystring too long and a whole lot of coincidence thrown in for good measure.
  • 首先确保uploads文件夹存在,并且写入权限设置为755或777 另外,您有两个未分配的变量$uploaded_size和$uploaded_type ,因此会失败。 您需要使用if ($_FILES["file"]["size"] <350000)等等,这可能是它失败的另一个原因。 尝试一下,看看这是否适合你,这就是我使用的: 修改$allowedExts = array("gif", "jpeg", "jpg", "png"); 允许的文件扩展名。 仅当尺寸小于350000才会上传 注意:将
  • 一步走1。 ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//' 如果连接确实通过eth0,这只会显示一些内容。 运行ifconfig以查看您正在使用的接口。 这也将显示您的机器具有的IP地址。 运行apache2后得到的错误是多方面的。 对于Could not reliably determine the server's ... 您可以在此处修复该特定 Could not reliably determine the ...
  • 如果我没有指定网址,他们会在什么网址上烧瓶? 从文档我明白,如果你这样设置 UPLOADS_DEFAULT_DEST = '/var/uploads/' UPLOADS_DEFAULT_URL = 'http://localhost:5000/' 然后,当您上传一组名为照片的照片时,会将其上传内容存储在/var/uploads/photos 。我们将其视为/var/uploads/photos/test.jpg 。然后,将/var/uploads/photos/test.jpg的照片作为 http://l ...
  • KInesis不是上传文件的正确工具,除非它们都很小 - 而且大多数视频几乎肯定会超过1MB的记录容量限制: 一个记录内的数据blob(Base64编码之前的数据有效载荷)的最大大小为1兆字节(MB)。 https://aws.amazon.com/kinesis/streams/faqs/ KInesis would not be the right tool to upload files, unless they were all very small - and most videos would ...
  • 关注点1:内存限制 readfile流,因此它被动态地转换为HTTP响应,并且不会被加载到完成的内存中。 但是,对于上传,脚本必须具有足够的内存,因为在上传和使用PHP时,如果我没有记错,整个文件就会进入内存。 关注点2:最大执行时间 如果您担心安全问题,请通过HTTPD服务器处理认证和访问权限。 然后,当请求无效时,您的脚本将不会执行。 Concern 1: Memory Limits readfile streams, so this is converted into the HTTP respons ...
  • 从技术上讲,PHP代表Apache处理上传,并在ram中缓冲文件直到完成。 但是,在上载完成(或中止)之前,您的脚本将无法获得控制权。 除非必须,否则Apache本身不会缓冲到磁盘。 可以把它想象成一个不可见的“handle_upload()”函数调用,它作为脚本中的第一件内容透明地插入。 回到“一切都是cgi脚本”的日子,当PHP等语言解释器未嵌入到Web服务器进程中时,POST数据通过标准输入发送到CGI脚本。文件将直接通过Apache传递到CGI进程,可能是它进来时逐字节读取。 The answer ...
  • 通常upload_tmp_dir是/ tmp。 这个/ tmp目录作为一些特殊权限( chmod 1777 ),其中真正的特殊权利是1 。 这是一个棘手的问题。 这意味着,对于目录,在此目录中创建的文件只能由文件所有者删除,即使任何其他rwx权限似乎适用于文件。 因此,上传存储在临时文件夹中的文件,其中包含由apache用户上传的1777权限,这意味着只有apache可以删除这些文件。 一个很好的起点。 您可以在datingPhotoUploads目录中使用此权限。 但您也可以尝试使用目录的组所有权来管理它 ...
  • 我花了很多时间用谷歌搜索后解决了问题。 问题出在Mono上,并已在最新版本(3.4)中修复。 我在我的Linux机器上安装了这个版本,悬而未决的问题就消失了。 更多细节在这里: https : //github.com/mono/mono/commit/a31b580fdcbaa9a8a16d59ffb12d04f5872f54e8 我现在有另一个问题。 在服务器端检索的映像文件已损坏。 鉴于相同的代码在Windows中运行,我倾向于认为问题取决于Mono或更可能,NancyFx的代码在Mono上。 我将进 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。