title: WCF returning Objects to Client
body: <p>I am trying to play around with WCF and I think I've hit a block. My issue is that I am able to call <code>Add(double,double)</code> and <code>getPerson()</code> from the "Client". However, I am not able to call any methods of <code>Person</code> object. I've stripped down the classes with bare methods. Here are my code snippets, please let me know what I am doing wrong..</p>
  
  <p><code>Server Code</code></p>
  
  <pre><code>  namespace Test.WebSvc{
    [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Sample")]
    public interface ICalculator
    {
      [OperationContract]
      double Add(double n1, double n2);
      [OperationContract]
      Person getPerson();
    }
  
  
   public class CalculatorService : ICalculator
   {
      public double Add(double n1, double n2) { return n1+n2 ; }
      public Person getPerson(){ 
      Person tempPerson = new Person();
      return tempPerson; 
      }
   }
  
   [DataContract]
   public class Person{
   [OperationContractAttribute]
   public string toString(){
   return "This is a Person Object";
   }
  </code></pre>
  
  <p><code>Client Code</code></p>
  
  <pre><code>ServiceRef1.CalculatorClient client = ServiceRef1.CalculatorClient();//works
  Console.WriteLine(client.Add(1.0,2.0)); //this too works   
  ServiceRef1.Person p = client.getPerson(); // this is OK., but is not doing what I wanted it to do
  Console.WriteLine(p.toString()); // I do not get "This is Person Object"
  </code></pre>
  
  <p>I am guessing something's wrong with my Person class' declaration.. but dint get a clue what should I do or what I am missing.. </p>
  
  <p>Thanks!</p>