我只能访问14个变量的内存 [英] I can access only memory for 14 variables

查看:71
本文介绍了我只能访问14个变量的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试开发一个程序,该程序需要在主存储器中存储1000个值,然后将它们写入文件中,但是我遇到的问题是我不确定它是什么.
在编译程序时,我利用了List的服务.和Array,但在这两种情况下,我只能访问14个变量.其余标记为?,?,这表示系统不了解索引和数据.
我已经做了很多尝试以在互联网上找到解决方案,但找不到任何帮助.
确实需要指导.

谢谢,
Farrukh Javeid

Hi,

I am trying to develop a program where I need to store 1000 values in the main memory and then write them into a file but I am having a problem that I am not sure what it is.
While compiling the program I have utilized the services of List<> and Array but in both cases I can only access only 14 variable. The rest are labeled as ?,?, which means the system has no idea of the index and the data.
I have tried a lot to find the solution on the internet but cant find any help.
Really need a guidance.

Thanks,
Farrukh Javeid

推荐答案

您所做的不清楚,更重要的是,您所说的不正确.访问1000个值几乎是零.而且您也可以随时在调试器中访问它们.问题可能出在您的价值观或如何解释所见.至少可以说,您的系统不了解索引和数据"听起来很荒谬.

—SA
What you did is not clear, and, more importantly, what you say is not true. Accessing 1000 values is next to nothing; and you can always access them in the debugger as well. The problem could be in your values or how you interpret what you see. Your "system has no idea of the index and the data" sounds ridiculous to say the least.

—SA


您似乎很想这样做:

1.创建一个数组或列表来保存字符串:string []或List< string>.

2.将一些字符串传递给验证函数,以确保它不是null,不仅是空格,等等,然后在检查新字符串是否与列表中的现有字符串不匹配之后,将其插入数组或列表中或数组.

可以很简单:
It seems clear that you want to:

1. create an Array or List to hold strings: string[], or List<string>.

2. pass in some string to a validation function that makes sure it is not null, not only whitespace, etc., and then insert the new string into the array or list after checking if it does not already match an existing string in the List or Array.

It can be this simple:
private List<string> urlList;

private void Form1_Load(object sender, EventArgs e)
{
    urlList = new List<string>() {"0", "1", "2", "3", "4"};
}

private void AddURL(string theURL)
{
    // this will handle string is null, empty, or all white space
    if (String.IsNullOrWhiteSpace()) return;

    // prevent duplication
    if (urlList.Contains(theURL)) return;

    urlList.Add(theURL);
}


这篇关于我只能访问14个变量的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆