public ContractDescription GetDiscoveryContract(ServiceDiscoveryMode discoveryMode)
 {
     if (discoveryMode == ServiceDiscoveryMode.Adhoc)
     {
         if (this.adhocDiscoveryContract == null)
         {
             lock (this.contractLock)
             {
                 if (this.adhocDiscoveryContract == null)
                 {
                     this.adhocDiscoveryContract = DiscoveryUtility.GetContract(typeof(IDiscoveryContractAdhoc11));
                 }
             }
         }
         return(this.adhocDiscoveryContract);
     }
     else if (discoveryMode == ServiceDiscoveryMode.Managed)
     {
         if (this.managedDiscoveryContract == null)
         {
             lock (this.contractLock)
             {
                 if (this.managedDiscoveryContract == null)
                 {
                     this.managedDiscoveryContract = DiscoveryUtility.GetContract(typeof(IDiscoveryContractManaged11));
                 }
             }
         }
         return(this.managedDiscoveryContract);
     }
     else
     {
         throw FxTrace.Exception.AsError(new ArgumentException(SR.DiscoveryIncorrectMode(discoveryMode)));
     }
 }
 public ContractDescription GetAnnouncementContract()
 {
     if (this.announcementContract == null)
     {
         lock (this.contractLock)
         {
             if (this.announcementContract == null)
             {
                 this.announcementContract = DiscoveryUtility.GetContract(typeof(IAnnouncementContract11));
             }
         }
     }
     return(this.announcementContract);
 }