c# - 索引超出范围(C# 数组)
问题描述
当我将 path[i,50] 打印到控制台时,将打印路径。但是当我尝试从该路径读取流( FileStream stream = File.OpenRead(path[i,50]) 时,我在上面的行中得到索引超出范围
string [,] path = new string [10,100];
byte[][] fileBytes = new byte[10][];
for (int i = 1; i <= 10; i++)
{
//defining path
path[i, 50] = @"C:\Users\t-chkum\Desktop\InputFiles\1MB\" + i + ".txt";
// Console.WriteLine(path[i,50]);
// readind data/*
FileStream stream = File.OpenRead(path[i,50]);
fileBytes[i] = new byte[stream.Length];
stream.Read(fileBytes[i], 0, fileBytes[i].Length);
stream.Close();
}
将不胜感激任何帮助:)
解决方案
推荐阅读
- arrays - 如何检查数组中元素的位置?
- apache-kafka - KTable-KTable 外键连接语义
- ansible - Ansible 用户模块:如何将 UID 定义为默认设置?
- sqlite - 按时间戳分组 sqlite3
- c++ - c++中动态内存分配的问题
- python - 压缩包含所有内容的文件夹,而不保留 Python 中的目录结构
- stripe-payments - Stripe - 在多个目的地之间分期付款
- javascript - 如何在 Express 中识别用户是否为管理员?
- node.js - 基于工作角色的授权在反应中的安全性如何?
- c# - 从路径加载图像(DataGridView)