Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望得到 10 个数字,我可以得到平均值/中位数。我已经在 Dll 库中编写了计算逻辑。但我不知道如何在前端使用表单获取多个输入。有没有我可以使用的类似get()or的功能Readline()(我们通常在控制台中使用)?
get()
Readline()
有几种方法可以处理这个问题。
第一个是单个文本框,它将以 1、2、3 或逗号分隔文本的形式从用户那里获取输入。这将允许您执行拆分以使用这些值。
第二种方法对用户来说可能更干净、更容易。使用 10 个文本框一次获取一个值。然后分别处理来自每个文本框的输入。
无论哪种方式,您都将使用 textboxname.Text 获取值,然后您可以将其传递给 int.Parse() 以将其转换为整数。