Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is _AppDomain prefixed with an underscore? Seriously, it bugs me that it is always in my field intellisense

Tags:

c#

.net

Whenever I write a new class and add some internal fields, I use an underscore prefix like so:

private readonly int _foo;

Why did the .NET team decide to create an AppDomain interface with the name _AppDomain? It just bugs me to see it whenever I type an underscore to get my class level fields in intellisense. Why isn't it IAppDomain or something else?

Yes, I am very picky... I know

like image 970
Rob Packwood Avatar asked Mar 17 '10 15:03

Rob Packwood


2 Answers

That interface exists for this purpose:

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

So I would imagine that as such there were more relaxed naming conventions for this type. It is hard to say why this was done though but the type most certainly does not conform to the Framework Design Guidelines.

like image 154
Andrew Hare Avatar answered Nov 14 '22 23:11

Andrew Hare


Such interfaces are made to interact with COM environment. e.g. you can find _Exception interface.

like image 40
Andrew Bezzub Avatar answered Nov 14 '22 22:11

Andrew Bezzub