WCF

WCF Examples

WCF

WCF Projects

WCF Project

Service contracts
Previous Home Next

The Service Contract Attribute is defined as:

[AttributeUsage(AttributeTargets.Interface|AttributeTargets.Class,
                Inherited = false)]
public sealed class ServiceContractAttribute : Attribute
{
   public string Name
   {get;set;}
   public string Namespace
   {get;set;}
   //More members
}

 

Defining and implementing a service contract:

[ServiceContract]
interface IMyContract
{
   [OperationContract]
   string show(string text);

   //Will not be part of the contract
   string show(string text);
}
class MyService : IMyContract
{
   public string show(string text)
   {
      return "Hello " + text;
   }
   public string show(string text)
   {
      return "Cannot call this method over WCF";
   }
}
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: