Conditional compilation depending on the framework version in C#

前端 未结 5 1370
無奈伤痛
無奈伤痛 2020-11-27 06:08

Are there any preprocessor symbols which allow something like

#if CLR_AT_LEAST_3.5
// use ReaderWriterLockSlim
#else
// use ReaderWriterLock
#endif
         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 06:59

    You could manually set this symbol using the /define compiler switch. Then you create different build configurations for each desired clr version.

提交回复
热议问题