c# - 为什么 _AppDomain 的前缀是下划线?说真的,这让我很烦恼,它总是在我的领域 intellisense

标签 c# .net

每当我编写一个新类并添加一些内部字段时,我都会使用下划线前缀,如下所示:

private readonly int _foo;

为什么 .NET 团队决定创建一个名为 _AppDomain 的 AppDomain 接口(interface)?每当我键入下划线以在智能感知中获取我的类级别字段时,看到它只会让我感到烦恼。为什么不是 IAppDomain 或其他东西?

是的,我很挑剔……我知道

最佳答案

该接口(interface)存在for this purpose:

Exposes the public members of the System.AppDomain class to unmanaged code. This API is not CLS-compliant.

因此,我认为这种类型有更宽松的命名约定。虽然很难说为什么这样做,但该类型肯定不符合框架设计指南。

关于c# - 为什么 _AppDomain 的前缀是下划线?说真的,这让我很烦恼,它总是在我的领域 intellisense,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2463650/

相关文章:

c# - 对事件 ApplicationStarted 使用未定义的关键字值 0x1。在 EnterpriseLibrary SLAB 中

c# - 为什么 AsyncLocal<T> 传播到子线程而 ThreadLocal<T> 不传播?

c# - 使用 LINQ to Objects 语句的 "a lot"是否有一些缺点?

.net - 泛型:访问新成员,而不是隐藏成员

c# - 当我使用区分大小写的语言时如何解决 COM 中不区分大小写的名称冲突

c# - 如何将 C 函数签名转换为 C# 并在 native DLL 中调用该函数?

c# - StackExchange Redis 删除所有以以下开头的键

c# - 在 C# 中,有什么方法可以将内存中的文件作为内存中的 SQLite 数据库与 System.Data.SQLite 链接?

c# - 如何断开与 socketio4net 的连接

c# - 工具提示中的超链接