title: Sharing an enum from C#, C++/CLI, and C++
body: <p>I have a library that consists of three parts.  First is native C++, which provides the actual functionality.  Second is a C++/CLI wrapper/adaptor for the C++ library, to simplify the C# to C++ transition.  Finally I have a C# library, which invokes the C++ library through the C++/CLI adaptor.</p>
  
  <p>Right now there I have two sets of parallel enum definitions, one stored in a .cs file and the other in a .h file.  This poses a double problem:</p>
  
  <ol>
  <li>I have dual maintenance.  I must always synchronize changes of an enum in both file locations.</li>
  <li>The namespace used by both enums should be identical but the C++/CLI wrapper, which views both sets of enums and translates between them, incurs a naming collision.</li>
  </ol>
  
  <p>Right now I'm not sure a solution such as <em><a href="http://blogs.msdn.com/b/abhinaba/archive/2007/08/27/sharing-enums-across-c-and-c.aspx" rel="noreferrer">this</a></em> or <em><a href="http://www.techtalkz.com/vc-net/67089-exposing-c-enum-managed-c-assembly.html#post283183" rel="noreferrer">that</a></em> would solve <strong>both</strong> problems.  Thoughts?</p>