<PrivateImplementationDetails>

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dm_dal

    #1

    <PrivateImplementationDetails>

    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


  • dm_dal

    #2
    Re: &lt;PrivateImpl ementationDetai ls&gt;

    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 <PrivateImpleme ntationDetails>
    question, please respond. I'm trying to learn as many tricks of the trade
    as I can.

    Thanks again,
    David

    "dm_dal" <REMOVE_THIS.dm y75252@yahoo.co m> wrote in message
    news:eKNhBXnoEH A.3324@TK2MSFTN GP15.phx.gbl...[color=blue]
    > 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
    >
    >[/color]


    Comment

    • Mattias Sjögren

      #3
      Re: &lt;PrivateImpl ementationDetai ls&gt;

      [color=blue]
      >I did a little more digging (experimenting) and it looks like the internal
      >class is in the AssemblyInfo.cs file,[/color]

      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?

      [color=blue]
      >Why would you want to define a class in that file? Would this be like a
      >global definition? Is this safe?[/color]

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

      [color=blue][color=green]
      >> 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?[/color][/color]

      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};

      [color=blue][color=green]
      >> 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?[/color][/color]

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



      Mattias

      --
      Mattias Sjögren [MVP] mattias @ mvps.org
      http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
      Please reply only to the newsgroup.

      Comment

      • David Young

        #4
        Re: &lt;PrivateImpl ementationDetai ls&gt;

        [color=blue]
        > 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?[/color]

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

        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"
        [color=blue]
        > 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};[/color]

        So how do you tell the compiler to generate the
        <PrivateImpleme ntationDetails> class and where does it get the information
        it needs?
        [color=blue][color=green][color=darkred]
        > >> Also, under this same namespace node (no name) there is an internal[/color][/color][/color]
        class.[color=blue][color=green][color=darkred]
        > >> How does one go about putting an internal class under this[/color][/color][/color]
        non-identified[color=blue][color=green][color=darkred]
        > >> namespace?[/color][/color]
        >
        > Just don't put it inside a namespace {} block.[/color]

        That makes sense.

        David Young


        Comment

        Working...