title: Amazon SNS client.publish is inaccessible due to protection level (C#)
body: <p>I have never worked with SNS before and am using this to try and learn how to send an email through SNS. I found this piece of code online that seems to do what I need. I have already set up the topic and whatnot in the browser and confirmed the connection between the topic and the email I intend to use. Here is the code:</p>
  <pre><code>using System;
  using System.Linq;
  using System.Threading.Tasks;
  
  using Amazon;
  using Amazon.SimpleNotificationService;
  using Amazon.SimpleNotificationService.Model;
  
  namespace Sns_test
  {
      class Program
      {
          static void Main(string[] args)
          {
              /* Topic ARNs must be in the correct format:
               *   arn:aws:sns:REGION:ACCOUNT_ID:NAME
               *
               *  where:
               *  REGION     is the region in which the topic is created, such as us-west-2
               *  ACCOUNT_ID is your (typically) 12-character account ID
               *  NAME       is the name of the topic
               */
              string topicArn = &quot;arn:aws:sns:us-east-2:058418336484:MailTest&quot;;
              string message = &quot;Hello at &quot; + DateTime.Now.ToShortTimeString();
  
              var client = new AmazonSimpleNotificationServiceClient(region: Amazon.RegionEndpoint.USWest2);
  
              var request = new PublishRequest
              {
                  Message = message,
                  TopicArn = topicArn
              };
  
  
              try
              {
                  var response = client.Publish(request);
  
                  Console.WriteLine(&quot;Message sent to topic:&quot;);
                  Console.WriteLine(message);
              }
              catch (Exception ex)
              {
                  Console.WriteLine(&quot;Caught exception publishing request:&quot;);
                  Console.WriteLine(ex.Message);
              }
          }
      }
  }
  </code></pre>
  <p>The problem is that here:</p>
  <pre><code>            try
              {
                  var response = client.Publish(request);
  
                  Console.WriteLine(&quot;Message sent to topic:&quot;);
                  Console.WriteLine(message);
              }
  </code></pre>
  <p>client.Publish(request) is inaccessible due to its protection level. Usually I can solve these problems when it's my code that is inaccessible but what do I do for a method that is built in to a library?</p>
  <p>This is the error message: [Error message][1]</p>
  <p>Any help would be appreciated :)</p>
  <p>EDIT: I managed to fix the problem by using client.PublishAsync instead but I'm still curious as to why client.Publish would be inaccessible.
  [1]: <a href="https://i.stack.imgur.com/av3fO.png" rel="nofollow noreferrer">https://i.stack.imgur.com/av3fO.png</a></p>