Method overloading in wcf service?
.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sushil Gupta37 reputationPosted Dec 15, 2014, 8:33 AM EST
[ServiceContract]
public interface ITest
{
[OperationContract(Name="Method1")]
string TestMethod(int para1,int para2);
//Initail method
[OperationContract(Name = "Method2")]
string TestMethod(string para1, string para2);
//Overloading on the basis of type of parameters.
[OperationContract(Name = "Method3")]
string TestMethod(int para1, string para2);
//Overloading on the basis of an order of parameters.
[OperationContract(Name = "Method4")]
string TestMethod(int para1, string para2,double para3);
//Overloading on the basis of the numbers of parameters}
}
using WCFConsoleClentApp.MyTest; namespace WCFConsoleClentApp { class Program { static void Main(string[] args) { TestClient client = new TestClient(); string callMethod1 = client.Method1(1, 1); string callMethod2 = client.Method2("Test", "Test"); string callMethod3 = client.Method3(1, "Test"); string callMethod4 = client.Method4(1, "Test", 3.5); } } } I used the link below