回答編集履歴

1

文章の修正

2019/08/19 07:25

投稿

BluOxy
BluOxy

スコア2663

test CHANGED
@@ -1,48 +1,16 @@
1
1
  こちらでどうでしょう。
2
+
3
+ 文字列から各要素(文字)を並び替えた`IEnumerable<Char>`を`string.Join`により結合した結果の文字列をtextBox2.Textに渡しています。
2
4
 
3
5
 
4
6
 
5
7
  ```C#
6
8
 
7
- using System;
9
+ private void button1_Click(object sender, EventArgs e)
8
10
 
9
- using System.Collections.Generic;
11
+ {
10
12
 
11
- using System.ComponentModel;
12
-
13
- using System.Data;
14
-
15
- using System.Drawing;
16
-
17
- using System.Linq;
18
-
19
- using System.Text;
20
-
21
- using System.Windows.Forms;
22
-
23
-
24
-
25
- namespace sort4 {
26
-
27
- public partial class Form1 : Form {
28
-
29
- public Form1 () {
30
-
31
- InitializeComponent ();
32
-
33
- }
34
-
35
-
36
-
37
- //ボタン1を押して実行
38
-
39
- private void button1_Click (object sender, EventArgs e) {
40
-
41
- textBox2.Text = string.Join("",textBox1.Text.OrderBy(x => x));
13
+ textBox2.Text = string.Join("",textBox1.Text.OrderBy(x => x));
42
-
43
- }
44
-
45
- }
46
14
 
47
15
  }
48
16