111,097
社区成员




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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<Test> ListT = new List<Test>();
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 4; i++)
{
Test Ts = new Test();
Ts.A1 = "我是A1值是" + i;
Ts.A2 = "我是A2值是" + i;
Ts.A3 = "我是A3值是" + i;
Ts.A4 = "我是A4值是" + i;
ListT.Add(Ts);
}
}
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.Text = "";
List<string> ListString = ListZh(ListT);
foreach (var item in ListString)
{
for (int i = 0; i < item.Split('|').Length; i++)
{
richTextBox1.Text += item.Split('|')[i];
richTextBox1.Text += "\r\n";
}
}
}
public List<string> ListZh(List<Test> ListTs)
{
List<string> ListString = new List<string>();
foreach (var item in ListTs)
{
string Pj = "";
Pj += item.A1+"|";
Pj += item.A2 + "|";
Pj += item.A3 + "|";
Pj += item.A4;
ListString.Add(Pj);
}
return ListString;
}
}
}