如何使用C#在Vs2010中使用阵列

编程入门 行业动态 更新时间:2024-10-10 23:25:07
本文介绍了如何使用C#在Vs2010中使用阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是c#的新手。我需要使用c#在asp网站中使用数组。我在asp网站上尝试二进制 搜索程序。我已经为二进制搜索编写了控制台程序。 现在我正在尝试使用相同的web表单。 我创建了一个文本框供用户输入数组的大小和一个按钮 使用在文本框中输入的数字输入来创建一个提到大小的数组。我的 问题是我应该在vs2010中使用什么,以便用户可以输入数组元素 ,因为我们用来进入控制台应用程序?

I'm new to c#. I need to use an array in asp website using c#. I'm trying a binary search program in asp 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方法msdn.microsoft/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 msdn.microsoft/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中使用阵列

本文发布于:2023-11-12 10:13:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581198.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阵列   如何使用

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!