Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
与我之前的问题有关。有没有办法在编译时阻止订阅?就像在实现者中将事件的“添加”标记为“私有”一样,即使它在接口中是公共的。
您可以定义编译宏,并环绕#if 标记。
#if DEBUG // do something only when we are launching Debug configuration #endif #if MYMACRO // do something only when this macro is defined #endif