diff --git a/test/csharp/CSharpClient.cs b/test/csharp/CSharpClient.cs
index 2cb6a83..d4d626f 100644
--- a/test/csharp/CSharpClient.cs
+++ b/test/csharp/CSharpClient.cs
@@ -1,68 +1,68 @@
-using System;
-using Thrift;
-using Thrift.Protocol;
-using Thrift.Server;
-using Thrift.Transport;
-
-
-namespace CSharpTutorial
-{
-    public class CSharpClient
-    {
-        public static void Main()
-        {
-            try
-            {
-                TTransport transport = new TSocket("localhost", 9090);
-                TProtocol protocol = new TBinaryProtocol(transport);
-                Calculator.Client client = new Calculator.Client(protocol);
-
-                transport.Open();
-
-                client.ping();
-                Console.WriteLine("ping()");
-
-                int sum = client.add(1, 1);
-                Console.WriteLine("1+1={0}", sum);
-
-                Work work = new Work();
-
-                work.op = Operation.DIVIDE;
-                work.num1 = 1;
-                work.num2 = 0;
-                try
-                {
-                    int quotient = client.calculate(1, work);
-                    Console.WriteLine("Whoa we can divide by 0");
-                }
-                catch (InvalidOperation io)
-                {
-                    Console.WriteLine("Invalid operation: " + io.why);
-                }
-
-                work.op = Operation.SUBTRACT;
-                work.num1 = 15;
-                work.num2 = 10;
-                try
-                {
-                    int diff = client.calculate(1, work);
-                    Console.WriteLine("15-10={0}", diff);
-                }
-                catch (InvalidOperation io)
-                {
-                    Console.WriteLine("Invalid operation: " + io.why);
-                }
-
-                SharedStruct log = client.getStruct(1);
-                Console.WriteLine("Check log: {0}", log.value);
-
-                transport.Close();
-            }
-            catch (TApplicationException x)
-            {
-                Console.WriteLine(x.StackTrace);
-            }
-
-        }
-    }
-}
\ No newline at end of file
+using System;
+using Thrift;
+using Thrift.Protocol;
+using Thrift.Server;
+using Thrift.Transport;
+
+
+namespace CSharpTutorial
+{
+    public class CSharpClient
+    {
+        public static void Main()
+        {
+            try
+            {
+                TTransport transport = new TSocket("localhost", 9090);
+                TProtocol protocol = new TBinaryProtocol(transport);
+                Calculator.Client client = new Calculator.Client(protocol);
+
+                transport.Open();
+
+                client.ping();
+                Console.WriteLine("ping()");
+
+                int sum = client.add(1, 1);
+                Console.WriteLine("1+1={0}", sum);
+
+                Work work = new Work();
+
+                work.op = Operation.DIVIDE;
+                work.num1 = 1;
+                work.num2 = 0;
+                try
+                {
+                    int quotient = client.calculate(1, work);
+                    Console.WriteLine("Whoa we can divide by 0");
+                }
+                catch (InvalidOperation io)
+                {
+                    Console.WriteLine("Invalid operation: " + io.why);
+                }
+
+                work.op = Operation.SUBTRACT;
+                work.num1 = 15;
+                work.num2 = 10;
+                try
+                {
+                    int diff = client.calculate(1, work);
+                    Console.WriteLine("15-10={0}", diff);
+                }
+                catch (InvalidOperation io)
+                {
+                    Console.WriteLine("Invalid operation: " + io.why);
+                }
+
+                SharedStruct log = client.getStruct(1);
+                Console.WriteLine("Check log: {0}", log.value);
+
+                transport.Close();
+            }
+            catch (TApplicationException x)
+            {
+                Console.WriteLine(x.StackTrace);
+            }
+
+        }
+    }
+}
