C# Equivalent for C++ Macros and using Auto<> Properties

后端 未结 7 2367
忘了有多久
忘了有多久 2021-02-20 15:55

I have some auto-instantiation code which I would like to apply to about 15 properties in a fairly big class. The code is similar to the following but the type is differ

7条回答
  •  北荒
    北荒 (楼主)
    2021-02-20 16:46

    You could use the much overlooked T4 (Text Template Transformation Toolkit) to generate the code. It is included with Visual Studio 2008.

    There was a 2009-06 .NET Rocks episode about it: "Peter Vogel uses Code Generation".

提交回复
热议问题