Code Clean-up and reorder type members

(on r#7.0)

I use the code clean-up feature a lot (every few minutes sometimes), and I have ‘reorder type members enabled’ as generally that’s what I want. Whoever, in some classes the order of properties is significant (i.e. when serializing). As my use of code clean-up is almost habitual I seldom think before I run it. As a result I often reorganise and therefore break classes used for serialisation. Is there an option to make a class or section of code as one that should not be re-ordered?

2 comments
Comment actions Permalink

Try modifying this part:

  <!--Do not reorder COM interfaces and structs marked by StructLayout attribute-->
  <Pattern>
    <Match>
      <Or Weight="100">
        <And>
          <Kind Is="interface"/>
          <Or>
            <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/>
            <HasAttribute CLRName="System.Runtime.InteropServices.ComImport"/>
          </Or>
        </And>
        <HasAttribute CLRName="System.Runtime.InteropServices.StructLayoutAttribute"/>
    <HasAttribute CLRName="System.SerializableAttribute"/>
      </Or>
    </Match>
  </Pattern>


I haven't tested it, but wouldn't be surprised if it works. You may have to fiddle with it.

0
Comment actions Permalink

Thanks, that worked!

0

Please sign in to leave a comment.