/// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="campaignId">Id of the campaign from which targeting
        /// criteria are retrieved.</param>
        public void Run(AdWordsUser user, long campaignId)
        {
            // Get the CampaignCriterionService.
              CampaignCriterionService campaignCriterionService =
              (CampaignCriterionService) user.GetService(
              AdWordsService.v201309.CampaignCriterionService);

              // Create the selector.
              Selector selector = new Selector();
              selector.fields = new string[] {"Id", "CriteriaType", "PlacementUrl"};

              // Set the filters.
              Predicate campaignPredicate = new Predicate();
              campaignPredicate.field = "CampaignId";
              campaignPredicate.@operator = PredicateOperator.EQUALS;
              campaignPredicate.values = new string[] {campaignId.ToString()};

              Predicate placementPredicate = new Predicate();
              placementPredicate.field = "CriteriaType";
              placementPredicate.@operator = PredicateOperator.EQUALS;
              placementPredicate.values = new string[] {"PLACEMENT"};

              selector.predicates = new Predicate[] {campaignPredicate, placementPredicate};

              // Set the selector paging.
              selector.paging = new Paging();

              int offset = 0;
              int pageSize = 500;

              CampaignCriterionPage page = new CampaignCriterionPage();

              try {
            do {
              selector.paging.startIndex = offset;
              selector.paging.numberResults = pageSize;

              // Get all campaign targets.
              page = campaignCriterionService.get(selector);

              // Display the results.
              if (page != null && page.entries != null) {
            int i = offset;
            foreach (CampaignCriterion campaignCriterion in page.entries) {
              Placement placement = campaignCriterion.criterion as Placement;

              Console.WriteLine("{0}) Placement with ID {1} and url {2} was found.", i,
                  placement.id, placement.url);
              i++;
            }
              }
              offset += pageSize;
            } while (offset < page.totalNumEntries);
            Console.WriteLine("Number of placements found: {0}", page.totalNumEntries);
              } catch (Exception ex) {
            throw new System.ApplicationException("Failed to get campaign targeting criteria.", ex);
              }
        }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="campaignId">Id of the campaign from which targeting
        /// criteria are retrieved.</param>
        public void Run(AdWordsUser user, long campaignId)
        {
            // Get the CampaignCriterionService.
              CampaignCriterionService campaignCriterionService =
              (CampaignCriterionService) user.GetService(
              AdWordsService.v201309.CampaignCriterionService);

              // Create the selector.
              Selector selector = new Selector();
              selector.fields = new string[] {"Id", "CriteriaType", "CampaignId"};

              // Set the filters.
              Predicate predicate = new Predicate();
              predicate.field = "CampaignId";
              predicate.@operator = PredicateOperator.EQUALS;
              predicate.values = new string[] {campaignId.ToString()};

              selector.predicates = new Predicate[] {predicate};

              // Set the selector paging.
              selector.paging = new Paging();

              int offset = 0;
              int pageSize = 500;

              CampaignCriterionPage page = new CampaignCriterionPage();

              try {
            do {
              selector.paging.startIndex = offset;
              selector.paging.numberResults = pageSize;

              // Get all campaign targets.
              page = campaignCriterionService.get(selector);

              // Display the results.
              if (page != null && page.entries != null) {
            int i = offset;
            foreach (CampaignCriterion campaignCriterion in page.entries) {
              string negative = (campaignCriterion is NegativeCampaignCriterion) ? "Negative " : "";
              Console.WriteLine("{0}) {1}Campaign criterion with id = '{2}' and Type = {3} was " +
                  " found for campaign id '{4}'", i, negative, campaignCriterion.criterion.id,
                  campaignCriterion.criterion.type, campaignCriterion.campaignId);
              i++;
            }
              }
              offset += pageSize;
            } while (offset < page.totalNumEntries);
            Console.WriteLine("Number of campaign targeting criteria found: {0}", page.totalNumEntries);
              } catch (Exception ex) {
            throw new System.ApplicationException("Failed to get campaign targeting criteria.", ex);
              }
        }