teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コードに```を追記しました。

2020/04/19 13:23

投稿

Jackal661
Jackal661

スコア7

title CHANGED
File without changes
body CHANGED
@@ -22,44 +22,69 @@
22
22
 
23
23
  C#
24
24
 
25
+
26
+ ```
27
+
25
28
  using System;
26
29
  using System.Collections.Generic;
27
30
 
28
31
  public class Hello{
32
+
29
33
  public static void Main(){
34
+
30
35
  var value = new tekito2();
31
36
 
32
37
  value.Property2 = 20;
38
+
33
- }
39
+ }
40
+
34
41
  }
35
42
 
36
43
  public class tekito1{
44
+
37
45
  int c ;
38
46
 
39
47
  public int Property{
48
+
40
49
  get{
50
+
41
51
  return c;
52
+
42
53
  }
54
+
43
55
  set{
56
+
44
57
  c = value;
58
+
45
59
  }
60
+
46
61
  }
62
+
47
63
  }
48
64
 
49
65
  public class tekito2{
66
+
50
67
  tekito1 a ;
51
68
 
52
69
  public int Property2{
53
70
 
54
71
  get{
72
+
55
73
  return a.Property;
74
+
56
75
  }
76
+
57
77
  set{
78
+
58
79
  a.Property = value;
80
+
59
81
  }
82
+
60
- }
83
+ }
84
+
61
85
  }
62
86
 
87
+ ```
63
88
  ### 発生したエラーの内容
64
89
  Unhandled Exception:
65
90
  System.NullReferenceException: Object reference not set to an instance of an object