【发布时间】:2014-10-14 13:53:56
【问题描述】:
我已经在 MSDN 和 Stack overflow 上四处寻找了一段时间,但我似乎找不到任何东西,我想合并一个 int 数组的元素。我查看了 string.join 但似乎找不到 int 的等价物
int[] myArray = new int[] {1,4};
int myArray[0] + myArray[1] would equal 14, Note that i want to merge them together
not mathematically add them.
整个程序:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Exercise2
{
/** Create a reference type called Person. Populate the Person class with the following properties to store the following information:
First name
Last name
Email address
Date of birth **/
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string DOB = tbDOB.Text;
DOB.Replace("\\"," ");
int[] iDOB = DOB.Select(n => Convert.ToInt32(n)).ToArray();
int day =
}
}
}
改成char数组会不会更好?
【问题讨论】:
-
只是想知道我能做些什么来提高问题的质量?我看到它很快就得到了 2 票反对