@@ -20,7 +20,7 @@ public void Execute()
2020 // (昇順の場合のascendingは付けても付けなくても良い)
2121 //
2222 var query1 = from person in persons
23- orderby person . Id . ToInt ( ) ascending
23+ orderby person . Id ! . ToInt ( ) ascending
2424 select person ;
2525
2626 Output . WriteLine ( "============================================" ) ;
@@ -33,7 +33,7 @@ orderby person.Id.ToInt() ascending
3333 // 降順.
3434 //
3535 var query2 = from person in persons
36- orderby person . Id . ToInt ( ) descending
36+ orderby person . Id ! . ToInt ( ) descending
3737 select person ;
3838
3939 Output . WriteLine ( "============================================" ) ;
@@ -46,7 +46,7 @@ orderby person.Id.ToInt() descending
4646 // 複数の条件でソート.
4747 //
4848 var query3 = from person in persons
49- orderby person . Address . PostCode , person . Id . ToInt ( )
49+ orderby person . Address ! . PostCode , person . Id ! . ToInt ( )
5050 select person ;
5151
5252 Output . WriteLine ( "============================================" ) ;
@@ -67,8 +67,8 @@ orderby person.Id.ToInt() descending
6767 // され直されてしまう。
6868 //
6969 var query4 = from person in persons
70- orderby person . Address . PostCode
71- orderby person . Id . ToInt ( )
70+ orderby person . Address ! . PostCode
71+ orderby person . Id ! . ToInt ( )
7272 select person ;
7373
7474 Output . WriteLine ( "============================================" ) ;
@@ -155,28 +155,28 @@ private enum Country
155155
156156 private class Person
157157 {
158- public string Id { get ; set ; }
158+ public string ? Id { get ; set ; }
159159
160- public string Name { get ; set ; }
160+ public string ? Name { get ; set ; }
161161
162- public AddressInfo Address { get ; set ; }
162+ public AddressInfo ? Address { get ; set ; }
163163
164- public Country Country { get ; set ; }
164+ public Country ? Country { get ; set ; }
165165 }
166166
167167 private class AddressInfo
168168 {
169- public string PostCode { get ; set ; }
169+ public string ? PostCode { get ; set ; }
170170
171- public string Prefecture { get ; set ; }
171+ public string ? Prefecture { get ; set ; }
172172
173- public string Municipality { get ; set ; }
173+ public string ? Municipality { get ; set ; }
174174
175- public string HouseNumber { get ; set ; }
175+ public string ? HouseNumber { get ; set ; }
176176
177- public string [ ] Tel { get ; set ; }
177+ public string [ ] ? Tel { get ; set ; }
178178
179- public string [ ] Frends { get ; set ; }
179+ public string [ ] ? Frends { get ; set ; }
180180 }
181181 }
182182}
0 commit comments