C# Macro definitions in Preprocessor(预处理器中的 C# 宏定义)
问题描述
C# 是否能够像在 C 编程语言中那样使用预处理器语句定义宏?我想简化某些重复语句的常规输入,例如:
Is C# able to define macros as is done in the C programming language with pre-processor statements? I would like to simplify regular typing of certain repeating statements such as the following:
Console.WriteLine("foo");
推荐答案
不,C# 不支持像 C 这样的预处理器宏.另一方面,Visual Studio 有 snippets.Visual Studio 的代码片段是 IDE 的一项功能,在编辑器中展开,而不是在由预处理器编译的代码中替换.
No, C# does not support preprocessor macros like C. Visual Studio on the other hand has snippets. Visual Studio's snippets are a feature of the IDE and are expanded in the editor rather than replaced in the code on compilation by a preprocessor.
这篇关于预处理器中的 C# 宏定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:预处理器中的 C# 宏定义


基础教程推荐
- 如果条件可以为空 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 将数据集转换为列表 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01