title: WCF: How to construct DataContracts for a type within a type
body: <p>I have a wcf service which exposes a function that returns a complex type as its return type. This response type in turn contains another complex object defined by me.  I am looking at creating data contracts for my WCF and am wondering how this is supposed to be done. I currently have this (some properties removed for ease of reading):</p>
  
  <p><strong>The Function</strong></p>
  
  <pre><code>///&lt;summary&gt;
  /// Interface to describe a cluster query WCF service.
  ///&lt;/summary&gt;
  [ServiceContract]
  public interface IClusterQueryWcfService
  {
      /// &lt;summary&gt;
      /// A method to retrieve the name of the necessary cluster table for a given zoom level, feature type and user type. 
      /// &lt;/summary&gt;
      /// &lt;param name="zoom"&gt;Integer value representing zoom level&lt;/param&gt;
      /// &lt;param name="featureType"&gt;The feature type string&lt;/param&gt;
      /// &lt;param name="user"&gt;User name&lt;/param&gt;
      /// &lt;returns&gt;RwolTableType made up of table name and table type.(See documentation)&lt;/returns&gt;
      [OperationContract]
      TableTypeResponse GetClusterTableForZoom(int zoom, string featureType, string user);
  </code></pre>
  
  <p><strong>Response Type</strong></p>
  
  <pre><code>/// &lt;summary&gt;
  /// The data contract for a TableTypeResponse object
  /// &lt;/summary&gt;
  [DataContract]
  public class TableTypeResponse
  {
      /// &lt;summary&gt;
      /// Property to manipulate the date and time of the method call.
      /// &lt;/summary&gt;
      [DataMember]
      public string DateTimeOfCall
      {
          get;
          set;
      }
  
      /// &lt;summary&gt;
      /// Property to get/set the StandardResponse type object included with a TableTypeResponse instance.
      /// &lt;/summary&gt;
      [DataMember]
      public StandardResponseType StandardResponse
      {
          get;
          set;
      }
  }
  </code></pre>
  
  <p><strong>Nested Type</strong></p>
  
  <pre><code>/// &lt;summary&gt;
  /// Data contract for a StandardResponseType object
  /// &lt;/summary&gt;
  [DataContract]
  public class StandardResponseType
  {
      /// &lt;summary&gt;
      /// Property to manipulate the date and time of the method call.
      /// &lt;/summary&gt;
      [DataMember]
      public string DateTimeOfCall
      {
          get;
          set;
      }
  
      /// &lt;summary&gt;
      /// Property to allow get and set of a message to provide more information to the user.
      /// &lt;/summary&gt;
      [DataMember]
      public string Message
      {
          get;
          set;
      }
  }
  </code></pre>
  
  <p>Is this code enough to make sure that the calling client knows the structure of the Standard response type held within the initial Response type? By which I mean will the data contract for the nested type actually be observed?</p>
  
  <p>I should add I am fairly new to using data contracts as previously I knew I had .net both sides.</p>