title: Passing and retrieving a class with methods through WCF service
body: <p>I want to pass/retrieve an instance of the following class through a wcf service. The object should carry the methods that are defined by its class also. is it possible? suppose the following class:</p>
  
  <pre><code>[DataContract]
  public class MyClass
  {
      [DataMember]
      public string Name;
  
      public MyClass()
      {
  
      }
  
      public MyClass(string name)
      {
          this.Name = name;
      }
  
      public void SetName(string name)
      {
          this.Name = name;
      }
  
      public string GetName()
      {
          return this.Name;
      }
  }
  
  [ServiceContract]
  public interface IMyService
  {
      [OperationContract]
      MyClass GetMyClassInstance();        
  }
  
  public class MyService:IMyService
  {
      public MyClass GetMyClassInstance()
      {
          return new MyClass("hello");
      }
  }
  </code></pre>
  
  <p>Now, when I add a reference to MyService in my client application project, the data contract MyClass will be generated, along with the service client, say MyServiceClient, so, and i do the following:</p>
  
  <pre><code>MyServiceClient client=new MyServiceClient();
  MyClass myClass1= client.GetMyClassInstance();
  </code></pre>
  
  <p>But my real question is, after getting the result from the service, whether this is possible(?) :</p>
  
  <pre><code>myClass1.SetName("oops!!!");
  </code></pre>
  
  <p>while transmitting data contracts, will the methods in them also be transmitted? My Business objects contain methods too, and they need to be passed through WCF. Is there a way? Is passing BOs such as this through WCF a good practice?
  Thanks in advance!</p>