title: Properties of C# structs get unusable names in COM and VB6?
body: <p>My C# code has a <code>struct</code> which I am exporting to COM. The properties of this struct are coming through with strange names that aren't even valid syntax in VB6, so they cannot be accessed.</p>
  
  <p><strong>Is there some way to get these to export with normal, usable names? Am I missing an attribute or something?</strong></p>
  
  <hr>
  
  <p>The format  of the name in COM / VB6 is:</p>
  
  <pre><code>&lt;original_name&gt;k__BackingField
  </code></pre>
  
  <p>where only the <code>original_name</code> part was in my C# code.</p>
  
  <p>I can only see these crazy property names in the VB6 Object Browser, Intellisense won't show it.</p>
  
  <p>Here's the (slightly sanitized) code which is being built:</p>
  
  <pre><code>[Guid("....")]
  [ComVisible(true)]
  public struct MyStruct
  {
      public string StringA { get; set; }
      public string StringB { get; set; }
  
      public MyStruct(string a, string b)
      {
          StringA = a;
          StringB = b;
      }
  
      ... // some other methods, no fields or properties
  }
  </code></pre>
  
  <p>and for good measure here is the IDL that gets generated:</p>
  
  <pre><code>typedef [uuid(....), version(1.0), custom(xxxx, MyNamespace.MyStruct)]
  struct tagMyStruct {
      LPSTR &lt;StringA&gt;k__BackingField;
      LPSTR &lt;StringB&gt;k__BackingField;
  } MyStruct;
  </code></pre>
  
  <p>as shown by OleView. I can see it contains the same <code>k__BackingField</code> as noted above. So it seems these names are coming from the C# typelib export process.</p>