<PrivateImplementationDetails>

  • Thread starter Thread starter dm_dal
  • Start date Start date
D

dm_dal

I was looking at some commercial assemblies that we had purchased through
Lutz Roeder's .Net Reflector, and noticed this entry in some of them.

What is it and how does it get there?

Also, under this same namespace node (no name) there is an internal class.
How does one go about putting an internal class under this non-identified
namespace? (it's the same one where you find the <Module> and AssemblyRef
classes.

David
 
I did a little more digging (experimenting) and it looks like the internal
class is in the AssemblyInfo.cs file, which leads me to another question.
Why would you want to define a class in that file? Would this be like a
global definition? Is this safe?

If you have answers to these or the original <PrivateImplementationDetails>
question, please respond. I'm trying to learn as many tricks of the trade
as I can.

Thanks again,
David
 
I did a little more digging (experimenting) and it looks like the internal
class is in the AssemblyInfo.cs file,

If you only have the compiled assembly and not the source or debug
symbols, how can you know which source file a class originates from?

Why would you want to define a class in that file? Would this be like a
global definition? Is this safe?

AssemblyInfo.cs is just another source file. Types defined there are
no less safe or more global than in other files.


It's a compiler generated class. It can be generated for example to
store array initialization data such as for code like this

int[] ints = {1,2,3,4,5};


Just don't put it inside a namespace {} block.



Mattias
 
If you only have the compiled assembly and not the source or debug
symbols, how can you know which source file a class originates from?

Trial and error. Since it appears with the <Method> and <AssemblyRef>
information and I believe this is set from the assembly manifest
(AssemblyInfo.cs) then I assumed that's where it was. I tried it with one
of my Assemblies and got the same results.
AssemblyInfo.cs is just another source file. Types defined there are
no less safe or more global than in other files.

I guess by my "more global" question I was really refering to the fact that
it could be used from any class, from within any namespace in your assembly,
without having to include a "using" statement for the namespace or typing
out the fully qualified type definition when you use it. Such as:

System.Windows.Forms.Form
if Form was defined in the AssemblyInfo.cs, any of your classes could use it
by just typing "Form"
It's a compiler generated class. It can be generated for example to
store array initialization data such as for code like this

int[] ints = {1,2,3,4,5};

So how do you tell the compiler to generate the
Just don't put it inside a namespace {} block.

That makes sense.

David Young
 
Back
Top