如何使用C#在Vs2010中使用阵列 [英] How Do I Use The Array In Vs2010 Using C#

查看:199
本文介绍了如何使用C#在Vs2010中使用阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是c#的新手。我需要使用c#在asp.net网站中使用数组。我在asp.net网站上尝试二进制

搜索程序。我已经为二进制搜索编写了控制台程序。

现在我正在尝试使用相同的web表单。

我创建了一个文本框供用户输入数组的大小和一个按钮

使用在文本框中输入的数字输入来创建一个提到大小的数组。我的

问题是我应该在vs2010中使用什么,以便用户可以输入数组元素

,因为我们用来进入控制台应用程序?

I'm new to c#. I need to use an array in asp.net website using c#. I'm trying a binary
search program in asp.net website. I have written the console program for binary search.
Now I'm trying to use the same with web form.
I have created a text box for the user to enter the size of the array and a button which
takes the numeric input entered in the text box to create an array of mentioned size. My
question is what should i need to use in vs2010 so that user can enter the elements
of the array as we use to enter in console application??

推荐答案

你的问题不是很清楚你需要什么帮助。



如果你是二元搜索试图实现,你不需要真正编码,你可以使用List,在列表中添加所有值,然后使用BinarySearch方法http://msdn.microsoft.com/en-us/library/w4e7fxsh(v=vs.110).aspx [ ^ ]



如果您的问题是关于UI,即如何使UI添加数字,有多种方式。你只需要一个文本框和两个按钮将数字添加到数组(它将继续记录文本框中输入的数字并添加到列表中)和执行搜索(将使用上面指出的方法或方法)执行搜索)。



但是正如SA提到的那样,你需要弄清楚你的基础知识并提出更多细节问题,以便你能得到所需的帮助。

谢谢
your question is not very clear as to what help you need.

If binary search is what you are trying to achieve, you don't need to code really, you can use List, add all your values in the list and then use "BinarySearch" method http://msdn.microsoft.com/en-us/library/w4e7fxsh(v=vs.110).aspx[^]

If your question is about UI i.e. how to make UI to add numbers, there are various ways. you can simply have one text box and two buttons "Add Number to Array" (which will keep taking the number entered in the textbox and add in the list) and "Perform Search" (which will either use your method or method indicated above to perform search).

But as SA mentioned, you need to get your fundamentals right and ask question with more details so that you can get help you need.
Thanks


这篇关于如何使用C#在Vs2010中使用阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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