THRIFT-4535: XML docs; code cleanup (tabs->spaces; String->string)
Client: C#
Patch: Christian Weiss

This closes #1524
diff --git a/lib/csharp/src/Transport/TBufferedTransport.cs b/lib/csharp/src/Transport/TBufferedTransport.cs
index c969419..9efeeb7 100644
--- a/lib/csharp/src/Transport/TBufferedTransport.cs
+++ b/lib/csharp/src/Transport/TBufferedTransport.cs
@@ -154,11 +154,11 @@
             {
                 if (disposing)
                 {
-                    if(inputBuffer != null)
+                    if (inputBuffer != null)
                         inputBuffer.Dispose();
-                    if(outputBuffer != null)
+                    if (outputBuffer != null)
                         outputBuffer.Dispose();
-                    if(transport != null)
+                    if (transport != null)
                         transport.Dispose();
                 }
             }
diff --git a/lib/csharp/src/Transport/TFramedTransport.cs b/lib/csharp/src/Transport/TFramedTransport.cs
index 0af8b1f..3436cc6 100644
--- a/lib/csharp/src/Transport/TFramedTransport.cs
+++ b/lib/csharp/src/Transport/TFramedTransport.cs
@@ -116,8 +116,8 @@
             byte[] buf = writeBuffer.GetBuffer();
             int len = (int)writeBuffer.Length;
             int data_len = len - HeaderSize;
-            if ( data_len < 0 )
-                throw new System.InvalidOperationException (); // logic error actually
+            if (data_len < 0)
+                throw new System.InvalidOperationException(); // logic error actually
 
             // Inject message header into the reserved buffer space
             EncodeFrameSize(data_len, buf);
@@ -130,7 +130,7 @@
             transport.Flush();
         }
 
-        private void InitWriteBuffer ()
+        private void InitWriteBuffer()
         {
             // Reserve space for message header to be put right before sending it out
             writeBuffer.SetLength(HeaderSize);
@@ -150,7 +150,7 @@
             return
                 ((buf[0] & 0xff) << 24) |
                 ((buf[1] & 0xff) << 16) |
-                ((buf[2] & 0xff) <<  8) |
+                ((buf[2] & 0xff) << 8) |
                 ((buf[3] & 0xff));
         }
 
@@ -171,11 +171,11 @@
             {
                 if (disposing)
                 {
-                    if(readBuffer != null)
+                    if (readBuffer != null)
                         readBuffer.Dispose();
-                    if(writeBuffer != null)
+                    if (writeBuffer != null)
                         writeBuffer.Dispose();
-                    if(transport != null)
+                    if (transport != null)
                         transport.Dispose();
                 }
             }
diff --git a/lib/csharp/src/Transport/THttpClient.cs b/lib/csharp/src/Transport/THttpClient.cs
index f678d1e..06ed6bc 100644
--- a/lib/csharp/src/Transport/THttpClient.cs
+++ b/lib/csharp/src/Transport/THttpClient.cs
@@ -30,7 +30,6 @@
 
 namespace Thrift.Transport
 {
-
     public class THttpClient : TTransport, IDisposable
     {
         private readonly Uri uri;
@@ -43,7 +42,7 @@
 
         private int readTimeout = 30000;
 
-        private IDictionary<String, String> customHeaders = new Dictionary<string, string>();
+        private IDictionary<string, string> customHeaders = new Dictionary<string, string>();
 
 #if !SILVERLIGHT
         private IWebProxy proxy = WebRequest.DefaultWebProxy;
@@ -64,7 +63,7 @@
         {
             set
             {
-               connectTimeout = value;
+                connectTimeout = value;
             }
         }
 
@@ -76,7 +75,7 @@
             }
         }
 
-        public IDictionary<String, String> CustomHeaders
+        public IDictionary<string, string> CustomHeaders
         {
             get
             {
@@ -325,7 +324,7 @@
         {
             try
             {
-                var flushAsyncResult = (FlushAsyncResult) asyncResult;
+                var flushAsyncResult = (FlushAsyncResult)asyncResult;
 
                 if (!flushAsyncResult.IsCompleted)
                 {
@@ -338,7 +337,8 @@
                 {
                     throw flushAsyncResult.AsyncException;
                 }
-            } finally
+            }
+            finally
             {
                 outputStream = new MemoryStream();
             }
@@ -387,9 +387,9 @@
             private volatile Boolean _isCompleted;
             private ManualResetEvent _evt;
             private readonly AsyncCallback _cbMethod;
-            private readonly Object _state;
+            private readonly object _state;
 
-            public FlushAsyncResult(AsyncCallback cbMethod, Object state)
+            public FlushAsyncResult(AsyncCallback cbMethod, object state)
             {
                 _cbMethod = cbMethod;
                 _state = state;
@@ -415,7 +415,7 @@
             {
                 get { return _isCompleted; }
             }
-            private readonly Object _locker = new Object();
+            private readonly object _locker = new object();
             private ManualResetEvent GetEvtHandle()
             {
                 lock (_locker)
@@ -452,7 +452,7 @@
             }
         }
 
-#region " IDisposable Support "
+        #region " IDisposable Support "
         private bool _IsDisposed;
 
         // IDisposable
@@ -470,6 +470,6 @@
             }
             _IsDisposed = true;
         }
-#endregion
+        #endregion
     }
 }
diff --git a/lib/csharp/src/Transport/TMemoryBuffer.cs b/lib/csharp/src/Transport/TMemoryBuffer.cs
index d8ff9dc..303d083 100644
--- a/lib/csharp/src/Transport/TMemoryBuffer.cs
+++ b/lib/csharp/src/Transport/TMemoryBuffer.cs
@@ -22,45 +22,56 @@
 using System.Reflection;
 using Thrift.Protocol;
 
-namespace Thrift.Transport {
-    public class TMemoryBuffer : TTransport {
+namespace Thrift.Transport
+{
+    public class TMemoryBuffer : TTransport
+    {
 
         private readonly MemoryStream byteStream;
 
-        public TMemoryBuffer() {
+        public TMemoryBuffer()
+        {
             byteStream = new MemoryStream();
         }
 
-        public TMemoryBuffer(byte[] buf) {
+        public TMemoryBuffer(byte[] buf)
+        {
             byteStream = new MemoryStream(buf);
         }
 
-        public override void Open() {
+        public override void Open()
+        {
             /** do nothing **/
         }
 
-        public override void Close() {
+        public override void Close()
+        {
             /** do nothing **/
         }
 
-        public override int Read(byte[] buf, int off, int len) {
+        public override int Read(byte[] buf, int off, int len)
+        {
             return byteStream.Read(buf, off, len);
         }
 
-        public override void Write(byte[] buf, int off, int len) {
+        public override void Write(byte[] buf, int off, int len)
+        {
             byteStream.Write(buf, off, len);
         }
 
-        public byte[] GetBuffer() {
+        public byte[] GetBuffer()
+        {
             return byteStream.ToArray();
         }
 
 
-        public override bool IsOpen {
+        public override bool IsOpen
+        {
             get { return true; }
         }
 
-        public static byte[] Serialize(TAbstractBase s) {
+        public static byte[] Serialize(TAbstractBase s)
+        {
             var t = new TMemoryBuffer();
             var p = new TBinaryProtocol(t);
 
@@ -69,26 +80,33 @@
             return t.GetBuffer();
         }
 
-        public static T DeSerialize<T>(byte[] buf) where T : TAbstractBase {
+        public static T DeSerialize<T>(byte[] buf) where T : TAbstractBase
+        {
             var trans = new TMemoryBuffer(buf);
             var p = new TBinaryProtocol(trans);
-            if (typeof (TBase).IsAssignableFrom(typeof (T))) {
-                var method = typeof (T).GetMethod("Read", BindingFlags.Instance | BindingFlags.Public);
+            if (typeof(TBase).IsAssignableFrom(typeof(T)))
+            {
+                var method = typeof(T).GetMethod("Read", BindingFlags.Instance | BindingFlags.Public);
                 var t = Activator.CreateInstance<T>();
-                method.Invoke(t, new object[] {p});
+                method.Invoke(t, new object[] { p });
                 return t;
-             } else {
-                   var method = typeof (T).GetMethod("Read", BindingFlags.Static | BindingFlags.Public);
-                return (T) method.Invoke(null, new object[] {p});
+            }
+            else
+            {
+                var method = typeof(T).GetMethod("Read", BindingFlags.Static | BindingFlags.Public);
+                return (T)method.Invoke(null, new object[] { p });
             }
         }
 
         private bool _IsDisposed;
 
         // IDisposable
-        protected override void Dispose(bool disposing) {
-            if (!_IsDisposed) {
-                if (disposing) {
+        protected override void Dispose(bool disposing)
+        {
+            if (!_IsDisposed)
+            {
+                if (disposing)
+                {
                     if (byteStream != null)
                         byteStream.Dispose();
                 }
@@ -96,4 +114,4 @@
             _IsDisposed = true;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/csharp/src/Transport/TNamedPipeClientTransport.cs b/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
index ea2e862..49a50aa 100644
--- a/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
+++ b/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
@@ -108,4 +108,4 @@
             client.Dispose();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/csharp/src/Transport/TServerSocket.cs b/lib/csharp/src/Transport/TServerSocket.cs
index e29a87e..40e47dc 100644
--- a/lib/csharp/src/Transport/TServerSocket.cs
+++ b/lib/csharp/src/Transport/TServerSocket.cs
@@ -27,150 +27,150 @@
 
 namespace Thrift.Transport
 {
-	public class TServerSocket : TServerTransport
-	{
-        /**
-        * Underlying server with socket
-        */
-		private TcpListener server = null;
+    public class TServerSocket : TServerTransport
+    {
+        /// <summary>
+        /// Underlying server with socket.
+        /// </summary>
+        private TcpListener server = null;
 
-		/**
-		 * Port to listen on
-		 */
-		private int port = 0;
+        /// <summary>
+        /// Port to listen on.
+        /// </summary>
+        private int port = 0;
 
-		/**
-		 * Timeout for client sockets from accept
-		 */
-		private int clientTimeout = 0;
+        /// <summary>
+        /// Timeout for client sockets from accept.
+        /// </summary>
+        private int clientTimeout = 0;
 
-		/**
-		 * Whether or not to wrap new TSocket connections in buffers
-		 */
-		private bool useBufferedSockets = false;
+        /// <summary>
+        /// Whether or not to wrap new TSocket connections in buffers.
+        /// </summary>
+        private bool useBufferedSockets = false;
 
-		/**
-		 * Creates a server socket from underlying socket object
-		 */
-		public TServerSocket(TcpListener listener)
-            :this(listener, 0)
-		{
-		}
+        /// <summary>
+        /// Creates a server socket from underlying socket object.
+        /// </summary>
+        public TServerSocket(TcpListener listener)
+            : this(listener, 0)
+        {
+        }
 
-		/**
-		 * Creates a server socket from underlying socket object
-		 */
-		public TServerSocket(TcpListener listener, int clientTimeout)
-		{
-			this.server = listener;
-			this.clientTimeout = clientTimeout;
-		}
+        /// <summary>
+        /// Creates a server socket from underlying socket object.
+        /// </summary>
+        public TServerSocket(TcpListener listener, int clientTimeout)
+        {
+            this.server = listener;
+            this.clientTimeout = clientTimeout;
+        }
 
-		/**
-		 * Creates just a port listening server socket
-		 */
-		public TServerSocket(int port)
-			: this(port, 0)
-		{
-		}
+        /// <summary>
+        /// Creates just a port listening server socket.
+        /// </summary>
+        public TServerSocket(int port)
+            : this(port, 0)
+        {
+        }
 
-		/**
-		 * Creates just a port listening server socket
-		 */
-		public TServerSocket(int port, int clientTimeout)
-            :this(port, clientTimeout, false)
-		{
-		}
+        /// <summary>
+        /// Creates just a port listening server socket.
+        /// </summary>
+        public TServerSocket(int port, int clientTimeout)
+            : this(port, clientTimeout, false)
+        {
+        }
 
-		public TServerSocket(int port, int clientTimeout, bool useBufferedSockets)
-		{
-			this.port = port;
-			this.clientTimeout = clientTimeout;
-			this.useBufferedSockets = useBufferedSockets;
-			try
-			{
-				// Make server socket
-				this.server = TSocketVersionizer.CreateTcpListener(this.port);
-				this.server.Server.NoDelay = true;
-			}
-			catch (Exception)
-			{
-				server = null;
-				throw new TTransportException("Could not create ServerSocket on port " + this.port + ".");
-			}
-		}
+        public TServerSocket(int port, int clientTimeout, bool useBufferedSockets)
+        {
+            this.port = port;
+            this.clientTimeout = clientTimeout;
+            this.useBufferedSockets = useBufferedSockets;
+            try
+            {
+                // Make server socket
+                this.server = TSocketVersionizer.CreateTcpListener(this.port);
+                this.server.Server.NoDelay = true;
+            }
+            catch (Exception)
+            {
+                server = null;
+                throw new TTransportException("Could not create ServerSocket on port " + this.port + ".");
+            }
+        }
 
-		public override void Listen()
-		{
-			// Make sure not to block on accept
-			if (server != null)
-			{
-				try
-				{
-					server.Start();
-				}
-				catch (SocketException sx)
-				{
-					throw new TTransportException("Could not accept on listening socket: " + sx.Message);
-				}
-			}
-		}
+        public override void Listen()
+        {
+            // Make sure not to block on accept
+            if (server != null)
+            {
+                try
+                {
+                    server.Start();
+                }
+                catch (SocketException sx)
+                {
+                    throw new TTransportException("Could not accept on listening socket: " + sx.Message);
+                }
+            }
+        }
 
-		protected override TTransport AcceptImpl()
-		{
-			if (server == null)
-			{
-				throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
-			}
-			try
-			{
-				TSocket result2 = null;
-				TcpClient result = server.AcceptTcpClient();
-				try
-				{
-					result2 = new TSocket(result);
-					result2.Timeout = clientTimeout;
-					if (useBufferedSockets)
-					{
-						TBufferedTransport result3 = new TBufferedTransport(result2);
-						return result3;
-					}
-					else
-					{
-						return result2;
-					}
-				}
-				catch (System.Exception)
-				{
-					// If a TSocket was successfully created, then let
-					// it do proper cleanup of the TcpClient object.
-					if (result2 != null)
-						result2.Dispose();
-					else //  Otherwise, clean it up ourselves.
-						((IDisposable)result).Dispose();
-					throw;
-				}
-			}
-			catch (Exception ex)
-			{
-				throw new TTransportException(ex.ToString());
-			}
-		}
+        protected override TTransport AcceptImpl()
+        {
+            if (server == null)
+            {
+                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
+            }
+            try
+            {
+                TSocket result2 = null;
+                TcpClient result = server.AcceptTcpClient();
+                try
+                {
+                    result2 = new TSocket(result);
+                    result2.Timeout = clientTimeout;
+                    if (useBufferedSockets)
+                    {
+                        TBufferedTransport result3 = new TBufferedTransport(result2);
+                        return result3;
+                    }
+                    else
+                    {
+                        return result2;
+                    }
+                }
+                catch (System.Exception)
+                {
+                    // If a TSocket was successfully created, then let
+                    // it do proper cleanup of the TcpClient object.
+                    if (result2 != null)
+                        result2.Dispose();
+                    else //  Otherwise, clean it up ourselves.
+                        ((IDisposable)result).Dispose();
+                    throw;
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new TTransportException(ex.ToString());
+            }
+        }
 
-		public override void Close()
-		{
-			if (server != null)
-			{
-				try
-				{
-					server.Stop();
-				}
-				catch (Exception ex)
-				{
-					throw new TTransportException("WARNING: Could not close server socket: " + ex);
-				}
-				server = null;
-			}
-		}
-	}
+        public override void Close()
+        {
+            if (server != null)
+            {
+                try
+                {
+                    server.Stop();
+                }
+                catch (Exception ex)
+                {
+                    throw new TTransportException("WARNING: Could not close server socket: " + ex);
+                }
+                server = null;
+            }
+        }
+    }
 }
diff --git a/lib/csharp/src/Transport/TServerTransport.cs b/lib/csharp/src/Transport/TServerTransport.cs
index 05d7d0f..e63880b 100644
--- a/lib/csharp/src/Transport/TServerTransport.cs
+++ b/lib/csharp/src/Transport/TServerTransport.cs
@@ -34,10 +34,11 @@
         public TTransport Accept()
         {
             TTransport transport = AcceptImpl();
-            if (transport == null) {
-              throw new TTransportException("accept() may not return NULL");
+            if (transport == null)
+            {
+                throw new TTransportException("accept() may not return NULL");
             }
             return transport;
-         }
+        }
     }
 }
diff --git a/lib/csharp/src/Transport/TSilverlightSocket.cs b/lib/csharp/src/Transport/TSilverlightSocket.cs
index cbd3baa..40469ab 100644
--- a/lib/csharp/src/Transport/TSilverlightSocket.cs
+++ b/lib/csharp/src/Transport/TSilverlightSocket.cs
@@ -112,7 +112,7 @@
                 throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected");
             }
 
-            if (String.IsNullOrEmpty(host))
+            if (string.IsNullOrEmpty(host))
             {
                 throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host");
             }
@@ -282,9 +282,9 @@
             private volatile Boolean _isCompleted;
             private ManualResetEvent _evt;
             private readonly AsyncCallback _cbMethod;
-            private readonly Object _state;
+            private readonly object _state;
 
-            public FlushAsyncResult(AsyncCallback cbMethod, Object state)
+            public FlushAsyncResult(AsyncCallback cbMethod, object state)
             {
                 _cbMethod = cbMethod;
                 _state = state;
@@ -314,7 +314,7 @@
                 get { return _isCompleted; }
             }
 
-            private readonly Object _locker = new Object();
+            private readonly object _locker = new object();
 
             private ManualResetEvent GetEvtHandle()
             {
@@ -362,7 +362,7 @@
             }
         }
 
-        #region " IDisposable Support "
+#region " IDisposable Support "
         private bool _IsDisposed;
 
         // IDisposable
@@ -385,7 +385,7 @@
             }
             _IsDisposed = true;
         }
-        #endregion
+#endregion
     }
 }
 
diff --git a/lib/csharp/src/Transport/TSocket.cs b/lib/csharp/src/Transport/TSocket.cs
index 7501e30..d8fa335 100644
--- a/lib/csharp/src/Transport/TSocket.cs
+++ b/lib/csharp/src/Transport/TSocket.cs
@@ -26,216 +26,220 @@
 
 namespace Thrift.Transport
 {
-	public class TSocket : TStreamTransport
-	{
-		private TcpClient client = null;
-		private string host = null;
-		private int port = 0;
-		private int timeout = 0;
+    public class TSocket : TStreamTransport
+    {
+        private TcpClient client = null;
+        private string host = null;
+        private int port = 0;
+        private int timeout = 0;
 
-		public TSocket(TcpClient client)
-		{
-			this.client = client;
+        public TSocket(TcpClient client)
+        {
+            this.client = client;
 
-			if (IsOpen)
-			{
-				inputStream = client.GetStream();
-				outputStream = client.GetStream();
-			}
-		}
+            if (IsOpen)
+            {
+                inputStream = client.GetStream();
+                outputStream = client.GetStream();
+            }
+        }
 
-		public TSocket(string host, int port)
-			: this(host, port, 0)
-		{
-		}
+        public TSocket(string host, int port)
+            : this(host, port, 0)
+        {
+        }
 
-		public TSocket(string host, int port, int timeout)
-		{
-			this.host = host;
-			this.port = port;
-			this.timeout = timeout;
+        public TSocket(string host, int port, int timeout)
+        {
+            this.host = host;
+            this.port = port;
+            this.timeout = timeout;
 
-			InitSocket();
-		}
+            InitSocket();
+        }
 
-		private void InitSocket()
-		{
-			this.client = TSocketVersionizer.CreateTcpClient();
-			this.client.ReceiveTimeout = client.SendTimeout = timeout;
-			this.client.Client.NoDelay = true;
-		}
+        private void InitSocket()
+        {
+            this.client = TSocketVersionizer.CreateTcpClient();
+            this.client.ReceiveTimeout = client.SendTimeout = timeout;
+            this.client.Client.NoDelay = true;
+        }
 
-		public int Timeout
-		{
-			set
-			{
-				client.ReceiveTimeout = client.SendTimeout = timeout = value;
-			}
-		}
+        public int Timeout
+        {
+            set
+            {
+                client.ReceiveTimeout = client.SendTimeout = timeout = value;
+            }
+        }
 
-		public TcpClient TcpClient
-		{
-			get
-			{
-				return client;
-			}
-		}
+        public TcpClient TcpClient
+        {
+            get
+            {
+                return client;
+            }
+        }
 
-		public string Host
-		{
-			get
-			{
-				return host;
-			}
-		}
+        public string Host
+        {
+            get
+            {
+                return host;
+            }
+        }
 
-		public int Port
-		{
-			get
-			{
-				return port;
-			}
-		}
+        public int Port
+        {
+            get
+            {
+                return port;
+            }
+        }
 
-		public override bool IsOpen
-		{
-			get
-			{
-				if (client == null)
-				{
-					return false;
-				}
+        public override bool IsOpen
+        {
+            get
+            {
+                if (client == null)
+                {
+                    return false;
+                }
 
-				return client.Connected;
-			}
-		}
+                return client.Connected;
+            }
+        }
 
-		public override void Open()
-		{
-			if (IsOpen)
-			{
-				throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected");
-			}
+        public override void Open()
+        {
+            if (IsOpen)
+            {
+                throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected");
+            }
 
-			if (String.IsNullOrEmpty(host))
-			{
-				throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host");
-			}
+            if (string.IsNullOrEmpty(host))
+            {
+                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host");
+            }
 
-			if (port <= 0)
-			{
-				throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port");
-			}
+            if (port <= 0)
+            {
+                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port");
+            }
 
-			if (client == null)
-			{
-				InitSocket();
-			}
+            if (client == null)
+            {
+                InitSocket();
+            }
 
-            if( timeout == 0)            // no timeout -> infinite
-			{
-				client.Connect(host, port);
-			}
-			else                        // we have a timeout -> use it
-			{
-				ConnectHelper hlp = new ConnectHelper(client);
-				IAsyncResult asyncres = client.BeginConnect(host, port, new AsyncCallback(ConnectCallback), hlp);
-				bool bConnected = asyncres.AsyncWaitHandle.WaitOne(timeout) && client.Connected;
-				if (!bConnected)
-				{
-					lock (hlp.Mutex)
-					{
-                        if( hlp.CallbackDone)
-						{
-							asyncres.AsyncWaitHandle.Close();
-							client.Close();
-						}
-						else
-						{
-							hlp.DoCleanup = true;
-							client = null;
-						}
-					}
-					throw new TTransportException(TTransportException.ExceptionType.TimedOut, "Connect timed out");
-				}
-			}
+            if (timeout == 0)            // no timeout -> infinite
+            {
+                client.Connect(host, port);
+            }
+            else                        // we have a timeout -> use it
+            {
+                ConnectHelper hlp = new ConnectHelper(client);
+                IAsyncResult asyncres = client.BeginConnect(host, port, new AsyncCallback(ConnectCallback), hlp);
+                bool bConnected = asyncres.AsyncWaitHandle.WaitOne(timeout) && client.Connected;
+                if (!bConnected)
+                {
+                    lock (hlp.Mutex)
+                    {
+                        if (hlp.CallbackDone)
+                        {
+                            asyncres.AsyncWaitHandle.Close();
+                            client.Close();
+                        }
+                        else
+                        {
+                            hlp.DoCleanup = true;
+                            client = null;
+                        }
+                    }
+                    throw new TTransportException(TTransportException.ExceptionType.TimedOut, "Connect timed out");
+                }
+            }
 
-			inputStream = client.GetStream();
-			outputStream = client.GetStream();
-		}
+            inputStream = client.GetStream();
+            outputStream = client.GetStream();
+        }
 
 
-		static void ConnectCallback(IAsyncResult asyncres)
-		{
-			ConnectHelper hlp = asyncres.AsyncState as ConnectHelper;
-			lock (hlp.Mutex)
-			{
-				hlp.CallbackDone = true;
+        static void ConnectCallback(IAsyncResult asyncres)
+        {
+            ConnectHelper hlp = asyncres.AsyncState as ConnectHelper;
+            lock (hlp.Mutex)
+            {
+                hlp.CallbackDone = true;
 
-				try
-				{
-                    if( hlp.Client.Client != null)
-						hlp.Client.EndConnect(asyncres);
-				}
-				catch (Exception)
-				{
-					// catch that away
-				}
+                try
+                {
+                    if (hlp.Client.Client != null)
+                        hlp.Client.EndConnect(asyncres);
+                }
+                catch (Exception)
+                {
+                    // catch that away
+                }
 
-				if (hlp.DoCleanup)
-				{
-                    try {
-						asyncres.AsyncWaitHandle.Close();
-                    } catch (Exception) {}
+                if (hlp.DoCleanup)
+                {
+                    try
+                    {
+                        asyncres.AsyncWaitHandle.Close();
+                    }
+                    catch (Exception) { }
 
-                    try {
-						if (hlp.Client is IDisposable)
-							((IDisposable)hlp.Client).Dispose();
-                    } catch (Exception) {}
-					hlp.Client = null;
-				}
-			}
-		}
+                    try
+                    {
+                        if (hlp.Client is IDisposable)
+                            ((IDisposable)hlp.Client).Dispose();
+                    }
+                    catch (Exception) { }
+                    hlp.Client = null;
+                }
+            }
+        }
 
-		private class ConnectHelper
-		{
-			public object Mutex = new object();
-			public bool DoCleanup = false;
-			public bool CallbackDone = false;
-			public TcpClient Client;
-			public ConnectHelper(TcpClient client)
-			{
-				Client = client;
-			}
-		}
+        private class ConnectHelper
+        {
+            public object Mutex = new object();
+            public bool DoCleanup = false;
+            public bool CallbackDone = false;
+            public TcpClient Client;
+            public ConnectHelper(TcpClient client)
+            {
+                Client = client;
+            }
+        }
 
-		public override void Close()
-		{
-			base.Close();
-			if (client != null)
-			{
-				client.Close();
-				client = null;
-			}
-		}
+        public override void Close()
+        {
+            base.Close();
+            if (client != null)
+            {
+                client.Close();
+                client = null;
+            }
+        }
 
-		#region " IDisposable Support "
-		private bool _IsDisposed;
+        #region " IDisposable Support "
+        private bool _IsDisposed;
 
-		// IDisposable
-		protected override void Dispose(bool disposing)
-		{
-			if (!_IsDisposed)
-			{
-				if (disposing)
-				{
-					if (client != null)
-						((IDisposable)client).Dispose();
-					base.Dispose(disposing);
-				}
-			}
-			_IsDisposed = true;
-		}
-		#endregion
-	}
+        // IDisposable
+        protected override void Dispose(bool disposing)
+        {
+            if (!_IsDisposed)
+            {
+                if (disposing)
+                {
+                    if (client != null)
+                        ((IDisposable)client).Dispose();
+                    base.Dispose(disposing);
+                }
+            }
+            _IsDisposed = true;
+        }
+        #endregion
+    }
 }
diff --git a/lib/csharp/src/Transport/TSocketVersionizer.cs b/lib/csharp/src/Transport/TSocketVersionizer.cs
index 904e519..bf4c0e4 100644
--- a/lib/csharp/src/Transport/TSocketVersionizer.cs
+++ b/lib/csharp/src/Transport/TSocketVersionizer.cs
@@ -1,4 +1,27 @@
-using System;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Contains some contributions under the Thrift Software License.
+ * Please see doc/old-thrift-license.txt in the Thrift distribution for
+ * details.
+ */
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Net.Sockets;
@@ -10,46 +33,46 @@
 
 namespace Thrift.Transport
 {
-	/**
-	* PropertyInfo for the DualMode property of the System.Net.Sockets.Socket class. Used to determine if the sockets are capable of
-	* automatic IPv4 and IPv6 handling. If DualMode is present the sockets automatically handle IPv4 and IPv6 connections.
-	* If the DualMode is not available the system configuration determines whether IPv4 or IPv6 is used.
-	*/
-	internal static class TSocketVersionizer
-	{
-		/*
-		* Creates a TcpClient according to the capabilitites of the used framework
-		*/
-		internal static TcpClient CreateTcpClient()
-		{
-			TcpClient client = null;
+    /// <summary>
+    /// PropertyInfo for the DualMode property of the System.Net.Sockets.Socket class. Used to determine if the sockets are capable of
+    /// automatic IPv4 and IPv6 handling. If DualMode is present the sockets automatically handle IPv4 and IPv6 connections.
+    /// If the DualMode is not available the system configuration determines whether IPv4 or IPv6 is used.
+    /// </summary>
+    internal static class TSocketVersionizer
+    {
+        /// <summary>
+        /// Creates a TcpClient according to the capabilitites of the used framework
+        /// </summary>
+        internal static TcpClient CreateTcpClient()
+        {
+            TcpClient client = null;
 
 #if NET45
-			client = new TcpClient(AddressFamily.InterNetworkV6);
-			client.Client.DualMode = true;
+            client = new TcpClient(AddressFamily.InterNetworkV6);
+            client.Client.DualMode = true;
 #else
             client = new TcpClient(AddressFamily.InterNetwork);
 #endif
 
-			return client;
-		}
+            return client;
+        }
 
-		/*
-		* Creates a TcpListener according to the capabilitites of the used framework
-		*/
-		internal static TcpListener CreateTcpListener(Int32 port)
-		{
-			TcpListener listener = null;
+        /// <summary>
+        /// Creates a TcpListener according to the capabilitites of the used framework.
+        /// </summary>
+        internal static TcpListener CreateTcpListener(Int32 port)
+        {
+            TcpListener listener = null;
 
 #if NET45
-			listener = new TcpListener(System.Net.IPAddress.IPv6Any, port);
-			listener.Server.DualMode = true;
+            listener = new TcpListener(System.Net.IPAddress.IPv6Any, port);
+            listener.Server.DualMode = true;
 #else
 
-			listener = new TcpListener(System.Net.IPAddress.Any, port);
+            listener = new TcpListener(System.Net.IPAddress.Any, port);
 #endif
 
             return listener;
-		}
-	}
+        }
+    }
 }
diff --git a/lib/csharp/src/Transport/TStreamTransport.cs b/lib/csharp/src/Transport/TStreamTransport.cs
index 468743c..304599f 100644
--- a/lib/csharp/src/Transport/TStreamTransport.cs
+++ b/lib/csharp/src/Transport/TStreamTransport.cs
@@ -105,24 +105,24 @@
         }
 
 
-    #region " IDisposable Support "
-    private bool _IsDisposed;
+        #region " IDisposable Support "
+        private bool _IsDisposed;
 
-    // IDisposable
-    protected override void Dispose(bool disposing)
-    {
-      if (!_IsDisposed)
-      {
-        if (disposing)
+        // IDisposable
+        protected override void Dispose(bool disposing)
         {
-          if (InputStream != null)
-            InputStream.Dispose();
-          if (OutputStream != null)
-            OutputStream.Dispose();
+            if (!_IsDisposed)
+            {
+                if (disposing)
+                {
+                    if (InputStream != null)
+                        InputStream.Dispose();
+                    if (OutputStream != null)
+                        OutputStream.Dispose();
+                }
+            }
+            _IsDisposed = true;
         }
-      }
-      _IsDisposed = true;
+        #endregion
     }
-    #endregion
-  }
 }
diff --git a/lib/csharp/src/Transport/TTLSServerSocket.cs b/lib/csharp/src/Transport/TTLSServerSocket.cs
index 24222b7..aa8ff7c 100644
--- a/lib/csharp/src/Transport/TTLSServerSocket.cs
+++ b/lib/csharp/src/Transport/TTLSServerSocket.cs
@@ -76,7 +76,7 @@
         /// <param name="port">The port where the server runs.</param>
         /// <param name="certificate">The certificate object.</param>
         public TTLSServerSocket(int port, X509Certificate2 certificate)
-            : this(port,  0, certificate)
+            : this(port, 0, certificate)
         {
         }
 
diff --git a/lib/csharp/src/Transport/TTLSSocket.cs b/lib/csharp/src/Transport/TTLSSocket.cs
index 27be0f4..fd019c3 100644
--- a/lib/csharp/src/Transport/TTLSSocket.cs
+++ b/lib/csharp/src/Transport/TTLSSocket.cs
@@ -263,7 +263,7 @@
         /// <param name="sender">The sender-object.</param>
         /// <param name="certificate">The used certificate.</param>
         /// <param name="chain">The certificate chain.</param>
-        /// <param name="sslPolicyErrors">An enum, which lists all the errors from the .NET certificate check.</param>
+        /// <param name="sslValidationErrors">An enum, which lists all the errors from the .NET certificate check.</param>
         /// <returns></returns>
         private bool DefaultCertificateValidator(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslValidationErrors)
         {
@@ -280,7 +280,7 @@
                 throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected");
             }
 
-            if (String.IsNullOrEmpty(host))
+            if (string.IsNullOrEmpty(host))
             {
                 throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host");
             }
@@ -307,7 +307,7 @@
         {
             RemoteCertificateValidationCallback validator = this.certValidator ?? DefaultCertificateValidator;
 
-            if( this.localCertificateSelectionCallback != null)
+            if (this.localCertificateSelectionCallback != null)
             {
                 this.secureStream = new SslStream(
                     this.client.GetStream(),
@@ -335,7 +335,7 @@
                 else
                 {
                     // Client authentication
-                    X509CertificateCollection certs = certificate != null ?  new X509CertificateCollection { certificate } : new X509CertificateCollection();
+                    X509CertificateCollection certs = certificate != null ? new X509CertificateCollection { certificate } : new X509CertificateCollection();
                     this.secureStream.AuthenticateAsClient(host, certs, sslProtocols, true);
                 }
             }
diff --git a/lib/csharp/src/Transport/TTransport.cs b/lib/csharp/src/Transport/TTransport.cs
index 6fb1077..5e4ac22 100644
--- a/lib/csharp/src/Transport/TTransport.cs
+++ b/lib/csharp/src/Transport/TTransport.cs
@@ -53,7 +53,7 @@
                 if (bytes == 0)
                     return false;
             }
-            catch( IOException)
+            catch (IOException)
             {
                 return false;
             }
@@ -108,7 +108,7 @@
 
         public virtual void Write(byte[] buf)
         {
-            Write (buf, 0, buf.Length);
+            Write(buf, 0, buf.Length);
         }
 
         public abstract void Write(byte[] buf, int off, int len);
diff --git a/lib/csharp/src/Transport/TTransportFactory.cs b/lib/csharp/src/Transport/TTransportFactory.cs
index fa10033..47a0c62 100644
--- a/lib/csharp/src/Transport/TTransportFactory.cs
+++ b/lib/csharp/src/Transport/TTransportFactory.cs
@@ -26,7 +26,7 @@
 namespace Thrift.Transport
 {
     /// <summary>
-    /// From Mark Slee & Aditya Agarwal of Facebook:
+    /// From Mark Slee &amp; Aditya Agarwal of Facebook:
     /// Factory class used to create wrapped instance of Transports.
     /// This is used primarily in servers, which get Transports from
     /// a ServerTransport and then may want to mutate them (i.e. create