title: WCF regarding class property types
body: <p>Ok so I am building my WCF service. I am having an issue with my proxy not generating code for classes that have types such as ListViewItem, or even the class objects that I already have defined.</p>
  
  <p>Two examples below are classes that I am trying to pass.</p>
  
  <p><strong>Example #1</strong></p>
  
  <pre><code>[DataContract]
  public class InvoiceCharges {
      #region Property...
      private int _invoiceChargeID;
      private ListViewItem _listViewItem;
  
      [DataMember]
      public int InvoiceChargeID {
          get { return _invoiceChargeID; }
          set { _invoiceChargeID = value; }
      }
      [DataMember]
      public ListViewItem ListViewItem {
          get { return _listViewItem; }
          set { _listViewItem = value; }
      }
      #endregion
  </code></pre>
  
  <p><strong>Example #2</strong></p>
  
  <pre><code>[DataContract]
  public class Users {
      #region Properties...
      private int _userID;
      private Divisions _Division = new Divisions();
  
      [DataMember]
      public int UserID {
          get { return _userID; }
          set { _userID = value; }
      }
      [DataMember]
      public Divisions Division {
          get { return _Division; }
          set { _Division = value; }
      }
  </code></pre>
  
  <p>In the 2nd example I am confused why it has a hard time just passing my Division class that it already sees. Surely WCF can pass your own custom objects?? Any help is greatly appreciated, I know on other platforms in order to Serialize your own custom object you have to do something special to your class. I wasn't sure if WCF handled this automatically or not.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Any other help on this is still appreciated.</p>
  
  <p>I have also tried adding the following to the InvoiceCharges class but was still unable to see the proxy generate correctly. </p>
  
  <pre><code>[KnownType(typeof(ListViewItem))]
  </code></pre>
  
  <p>Also, this is the behavior of the proxy. I am using Add Service Reference to do this.</p>
  
  <p><img src="https://i.stack.imgur.com/rHhmh.png" alt="enter image description here"></p>
  
  <p>See how it is generating several "InvoiceCharges" its all because of that ListViewItem. I can remove the DataMember attribute off of it and its fine.</p>