質問編集履歴

2

コードのタブあったのね,見落としでした.

2017/05/10 10:25

投稿

Arneco
Arneco

スコア6

test CHANGED
File without changes
test CHANGED
@@ -16,17 +16,21 @@
16
16
 
17
17
  ###該当のソースコード
18
18
 
19
- static void Main(){
19
+ ```ここに言語を入力
20
20
 
21
- int a,b;
21
+ static void Main()
22
22
 
23
- string c;
23
+ {
24
24
 
25
- var strList=new List<string>();
25
+ int a, b;
26
26
 
27
- strList=GetConsoleReader(); //入力文字列をリストに格納する関数
27
+ string c;
28
28
 
29
+ var strList = new List<string>();
30
+
31
+ strList = GetConsoleReader(); //入力文字列をリストに格納する関数
32
+
29
- Input(strList,a,b,c); //a,b,cにstrList[0],[1],[2]を入れたい
33
+ Input(strList, a, b, c); //a,b,cにstrList[0],[1],[2]を入れたい
30
34
 
31
35
  }
32
36
 
@@ -36,25 +40,39 @@
36
40
 
37
41
  {
38
42
 
39
- int count=0;
43
+ int count = 0;
40
44
 
41
- foreach(string str in strList){
45
+ foreach (string str in strList)
42
46
 
43
- if(inputData[count] is int){
47
+ {
44
48
 
45
- inputData[count]=int.Parse(str);
49
+ if (inputData[count] is int)
46
50
 
47
- }if(inputData[count] is string){
51
+ {
48
52
 
49
- inputData[count]=str;
53
+ inputData[count] = int.Parse(str);
50
54
 
51
- }
55
+ }
52
56
 
57
+ if (inputData[count] is string)
58
+
59
+ {
60
+
61
+ inputData[count] = str;
62
+
63
+ }
64
+
53
- count++;
65
+ count++;
66
+
67
+ }
54
68
 
55
69
  }
56
70
 
57
- }
71
+ ```
72
+
73
+
74
+
75
+
58
76
 
59
77
 
60
78
 

1

コードを少し具体的にしてみました.

2017/05/10 10:25

投稿

Arneco
Arneco

スコア6

test CHANGED
File without changes
test CHANGED
@@ -10,9 +10,51 @@
10
10
 
11
11
 
12
12
 
13
+ 追記:引数に文字列のリストと複数の変数を入れると,変数にリストの値が順番に入るような処理を考えています.
14
+
15
+
16
+
13
17
  ###該当のソースコード
14
18
 
19
+ static void Main(){
20
+
21
+ int a,b;
22
+
23
+ string c;
24
+
25
+ var strList=new List<string>();
26
+
27
+ strList=GetConsoleReader(); //入力文字列をリストに格納する関数
28
+
29
+ Input(strList,a,b,c); //a,b,cにstrList[0],[1],[2]を入れたい
30
+
31
+ }
32
+
33
+
34
+
15
- public void Method(out params Object[] inputData)
35
+ public void Input(List<string> strList,**out params** Object[] inputData) //エラー箇所
36
+
37
+ {
38
+
39
+ int count=0;
40
+
41
+ foreach(string str in strList){
42
+
43
+ if(inputData[count] is int){
44
+
45
+ inputData[count]=int.Parse(str);
46
+
47
+ }if(inputData[count] is string){
48
+
49
+ inputData[count]=str;
50
+
51
+ }
52
+
53
+ count++;
54
+
55
+ }
56
+
57
+ }
16
58
 
17
59
 
18
60