回答編集履歴
1
追記
test
CHANGED
@@ -225,3 +225,103 @@
|
|
225
225
|
}
|
226
226
|
|
227
227
|
```
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
###追記
|
232
|
+
|
233
|
+
プロパティ名だけでなく型も指定する場合
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
```C#
|
238
|
+
|
239
|
+
<#@ template debug="false" hostspecific="false" language="C#" #>
|
240
|
+
|
241
|
+
<#@ assembly name="System.Core" #>
|
242
|
+
|
243
|
+
<#@ import namespace="System.Linq" #>
|
244
|
+
|
245
|
+
<#@ import namespace="System.Text" #>
|
246
|
+
|
247
|
+
<#@ import namespace="System.Collections.Generic" #>
|
248
|
+
|
249
|
+
<#@ output extension=".cs" #>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
using System;
|
254
|
+
|
255
|
+
using System.Collections.Generic;
|
256
|
+
|
257
|
+
using System.Linq;
|
258
|
+
|
259
|
+
using System.Text;
|
260
|
+
|
261
|
+
using System.Threading.Tasks;
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
namespace ConsoleApp1
|
266
|
+
|
267
|
+
{
|
268
|
+
|
269
|
+
public partial class Class1
|
270
|
+
|
271
|
+
{
|
272
|
+
|
273
|
+
<#
|
274
|
+
|
275
|
+
var properties = new[]
|
276
|
+
|
277
|
+
{
|
278
|
+
|
279
|
+
new { Name = "xAccell", Type = "string" },
|
280
|
+
|
281
|
+
new { Name = "yAccell", Type = "string" },
|
282
|
+
|
283
|
+
new { Name = "zAccell", Type = "string" },
|
284
|
+
|
285
|
+
new { Name = "xHoge", Type = "string" },
|
286
|
+
|
287
|
+
};
|
288
|
+
|
289
|
+
foreach (var property in properties)
|
290
|
+
|
291
|
+
{
|
292
|
+
|
293
|
+
#>
|
294
|
+
|
295
|
+
private <#= property.Type #> _<#= property.Name #>;
|
296
|
+
|
297
|
+
public <#= property.Type #> <#= property.Name #>
|
298
|
+
|
299
|
+
{
|
300
|
+
|
301
|
+
get => _<#= property.Name #>;
|
302
|
+
|
303
|
+
set
|
304
|
+
|
305
|
+
{
|
306
|
+
|
307
|
+
if (value == _<#= property.Name #>) return;
|
308
|
+
|
309
|
+
_<#= property.Name #> = value;
|
310
|
+
|
311
|
+
OnPropertyChanged("<#= property.Name #>");
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
<#
|
318
|
+
|
319
|
+
}
|
320
|
+
|
321
|
+
#>
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
```
|