Consider a WCF service that returns some text that you entered. The service has a contract called IService1 and an operation called GetData. When we run the service in our test client, we see:

The code for this is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace Carl.TestWCF
{
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetData(int value);
}
}
Let’s say we want the service and operation to be different to what the WCF consumer will see. In order to do this, we decorate our methods below with:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace Carl.TestWCF
{
[ServiceContract(Name = "Return What Was Entered")]
public interface IService1
{
[OperationContract(Name ="Do The Returning")]
string GetData(int value);
}
}
When we run our test client now, we can see the names have changed:


Keep learning. Keep building.
Explore AI, agents & Microsoft technology.
I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.
Subscribe on YouTube →Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert
