THRIFT-5396 deprecate "Async" method postfix
Client: netstd
Patch: Jens Geyer

This closes #2374
diff --git a/tutorial/netstd/Client/Program.cs b/tutorial/netstd/Client/Program.cs
index f3e93ce..9c47450 100644
--- a/tutorial/netstd/Client/Program.cs
+++ b/tutorial/netstd/Client/Program.cs
@@ -41,7 +41,7 @@
 {
     public class Program
     {
-        private static readonly ServiceCollection ServiceCollection = new ServiceCollection();
+        private static readonly ServiceCollection ServiceCollection = new();
         private static ILogger Logger;
         private static readonly TConfiguration Configuration = null;  // new TConfiguration() if  needed
 
@@ -287,17 +287,13 @@
         private static TProtocol MakeProtocol(string[] args, TTransport transport)
         {
             Protocol selectedProtocol = GetProtocol(args);
-            switch (selectedProtocol)
+            return selectedProtocol switch
             {
-                case Protocol.Binary:
-                    return new TBinaryProtocol(transport);
-                case Protocol.Compact:
-                    return new TCompactProtocol(transport);
-                case Protocol.Json:
-                    return new TJsonProtocol(transport);
-                default:
-                    throw new Exception("unhandled protocol");
-            }
+                Protocol.Binary => new TBinaryProtocol(transport),
+                Protocol.Compact => new TCompactProtocol(transport),
+                Protocol.Json => new TJsonProtocol(transport),
+                _ => throw new Exception("unhandled protocol"),
+            };
         }
 
         private static async Task RunClientAsync(TProtocol protocol, bool multiplex, CancellationToken cancellationToken)
@@ -333,12 +329,12 @@
 
             // Async version
 
-            Logger.LogInformation($"{client.ClientId} PingAsync()");
-            await client.pingAsync(cancellationToken);
+            Logger.LogInformation($"{client.ClientId} Ping()");
+            await client.ping(cancellationToken);
 
-            Logger.LogInformation($"{client.ClientId} AddAsync(1,1)");
-            var sum = await client.addAsync(1, 1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} AddAsync(1,1)={sum}");
+            Logger.LogInformation($"{client.ClientId} Add(1,1)");
+            var sum = await client.add(1, 1, cancellationToken);
+            Logger.LogInformation($"{client.ClientId} Add(1,1)={sum}");
 
             var work = new Work
             {
@@ -349,8 +345,8 @@
 
             try
             {
-                Logger.LogInformation($"{client.ClientId} CalculateAsync(1)");
-                await client.calculateAsync(1, work, cancellationToken);
+                Logger.LogInformation($"{client.ClientId} Calculate(1)");
+                await client.calculate(1, work, cancellationToken);
                 Logger.LogInformation($"{client.ClientId} Whoa we can divide by 0");
             }
             catch (InvalidOperation io)
@@ -364,8 +360,8 @@
 
             try
             {
-                Logger.LogInformation($"{client.ClientId} CalculateAsync(1)");
-                var diff = await client.calculateAsync(1, work, cancellationToken);
+                Logger.LogInformation($"{client.ClientId} Calculate(1)");
+                var diff = await client.calculate(1, work, cancellationToken);
                 Logger.LogInformation($"{client.ClientId} 15-10={diff}");
             }
             catch (InvalidOperation io)
@@ -373,12 +369,12 @@
                 Logger.LogInformation($"{client.ClientId} Invalid operation: " + io);
             }
 
-            Logger.LogInformation($"{client.ClientId} GetStructAsync(1)");
-            var log = await client.getStructAsync(1, cancellationToken);
+            Logger.LogInformation($"{client.ClientId} GetStruct(1)");
+            var log = await client.getStruct(1, cancellationToken);
             Logger.LogInformation($"{client.ClientId} Check log: {log.Value}");
 
-            Logger.LogInformation($"{client.ClientId} ZipAsync() with delay 100mc on server side");
-            await client.zipAsync(cancellationToken);
+            Logger.LogInformation($"{client.ClientId} Zip() with delay 100mc on server side");
+            await client.zip(cancellationToken);
         }
 
 
diff --git a/tutorial/netstd/Server/Program.cs b/tutorial/netstd/Server/Program.cs
index df8f390..80205d5 100644
--- a/tutorial/netstd/Server/Program.cs
+++ b/tutorial/netstd/Server/Program.cs
@@ -45,7 +45,7 @@
 {
     public class Program
     {
-        private static readonly ServiceCollection ServiceCollection = new ServiceCollection();
+        private static readonly ServiceCollection ServiceCollection = new();
         private static ILogger Logger;
         private static readonly TConfiguration Configuration = null;  // new TConfiguration() if  needed
 
@@ -186,55 +186,30 @@
 
         private static async Task RunSelectedConfigurationAsync(Transport transport, Buffering buffering, Protocol protocol, bool multiplex, CancellationToken cancellationToken)
         {
-            TServerTransport serverTransport = null;
-            switch (transport)
+            TServerTransport serverTransport = transport switch
             {
-                case Transport.Tcp:
-                    serverTransport = new TServerSocketTransport(9090, Configuration);
-                    break;
-                case Transport.NamedPipe:
-                    serverTransport = new TNamedPipeServerTransport(".test", Configuration);
-                    break;
-                case Transport.TcpTls:
-                    serverTransport = new TTlsServerSocketTransport(9090, Configuration,
-                        GetCertificate(), ClientCertValidator, LocalCertificateSelectionCallback);
-                    break;
-            }
+                Transport.Tcp => new TServerSocketTransport(9090, Configuration),
+                Transport.NamedPipe => new TNamedPipeServerTransport(".test", Configuration, NamedPipeClientFlags.None),
+                Transport.TcpTls => new TTlsServerSocketTransport(9090, Configuration, GetCertificate(), ClientCertValidator, LocalCertificateSelectionCallback),
+                _ => throw new ArgumentException("unsupported value $transport", nameof(transport)),
+            };
 
-            TTransportFactory transportFactory = null;
-            switch (buffering)
+            TTransportFactory transportFactory = buffering switch
             {
-                case Buffering.Buffered:
-                    transportFactory = new TBufferedTransport.Factory();
-                    break;
+                Buffering.Buffered => new TBufferedTransport.Factory(),
+                Buffering.Framed => new TFramedTransport.Factory(),
+                // layered transport(s) are optional
+                Buffering.None => null,
+                _ => throw new ArgumentException("unsupported value $buffering", nameof(buffering)),
+            };
 
-                case Buffering.Framed:
-                    transportFactory = new TFramedTransport.Factory();
-                    break;
-
-                default: // layered transport(s) are optional
-                    Debug.Assert(buffering == Buffering.None, "unhandled case");
-                    break;
-            }
-
-            TProtocolFactory protocolFactory = null;
-            switch (protocol)
+            TProtocolFactory protocolFactory = protocol switch
             {
-                case Protocol.Binary:
-                    protocolFactory = new TBinaryProtocol.Factory();
-                    break;
-
-                case Protocol.Compact:
-                    protocolFactory = new TCompactProtocol.Factory();
-                    break;
-
-                case Protocol.Json:
-                    protocolFactory = new TJsonProtocol.Factory();
-                    break;
-
-                default:
-                    throw new ArgumentOutOfRangeException(nameof(protocol), protocol, null);
-            }
+                Protocol.Binary => new TBinaryProtocol.Factory(),
+                Protocol.Compact => new TCompactProtocol.Factory(),
+                Protocol.Json => new TJsonProtocol.Factory(),
+                _ => throw new ArgumentException("unsupported value $protocol", nameof(protocol)),
+            };
 
             var handler = new CalculatorAsyncHandler();
             ITAsyncProcessor processor = new Calculator.AsyncProcessor(handler);
@@ -395,34 +370,34 @@
 
         public class CalculatorAsyncHandler : Calculator.IAsync
         {
-            private readonly Dictionary<int, SharedStruct> _log = new Dictionary<int, SharedStruct>();
+            private readonly Dictionary<int, SharedStruct> _log = new();
 
             public CalculatorAsyncHandler()
             {
             }
 
-            public async Task<SharedStruct> getStructAsync(int key,
+            public async Task<SharedStruct> getStruct(int key,
                 CancellationToken cancellationToken)
             {
-                Logger.LogInformation("GetStructAsync({0})", key);
+                Logger.LogInformation("GetStruct({0})", key);
                 return await Task.FromResult(_log[key]);
             }
 
-            public async Task pingAsync(CancellationToken cancellationToken)
+            public async Task ping(CancellationToken cancellationToken)
             {
-                Logger.LogInformation("PingAsync()");
+                Logger.LogInformation("Ping()");
                 await Task.CompletedTask;
             }
 
-            public async Task<int> addAsync(int num1, int num2, CancellationToken cancellationToken)
+            public async Task<int> add(int num1, int num2, CancellationToken cancellationToken)
             {
-                Logger.LogInformation($"AddAsync({num1},{num2})");
+                Logger.LogInformation($"Add({num1},{num2})");
                 return await Task.FromResult(num1 + num2);
             }
 
-            public async Task<int> calculateAsync(int logid, Work w, CancellationToken cancellationToken)
+            public async Task<int> calculate(int logid, Work w, CancellationToken cancellationToken)
             {
-                Logger.LogInformation($"CalculateAsync({logid}, [{w.Op},{w.Num1},{w.Num2}])");
+                Logger.LogInformation($"Calculate({logid}, [{w.Op},{w.Num1},{w.Num2}])");
 
                 int val;
                 switch (w.Op)
@@ -476,22 +451,22 @@
                 return await Task.FromResult(val);
             }
 
-            public async Task zipAsync(CancellationToken cancellationToken)
+            public async Task zip(CancellationToken cancellationToken)
             {
-                Logger.LogInformation("ZipAsync() with delay 100mc");
+                Logger.LogInformation("Zip() with delay 100mc");
                 await Task.Delay(100, CancellationToken.None);
             }
         }
 
         public class SharedServiceAsyncHandler : SharedService.IAsync
         {
-            public async Task<SharedStruct> getStructAsync(int key, CancellationToken cancellationToken)
+            public async Task<SharedStruct> getStruct(int key, CancellationToken cancellationToken)
             {
-                Logger.LogInformation("GetStructAsync({0})", key);
+                Logger.LogInformation("GetStruct({0})", key);
                 return await Task.FromResult(new SharedStruct()
                 {
                     Key = key,
-                    Value = "GetStructAsync"
+                    Value = "GetStruct"
                 });
             }
         }