THRIFT-2032 C# client leaks sockets/handles

Patch: Jens Geyer
diff --git a/lib/csharp/src/Protocol/TProtocol.cs b/lib/csharp/src/Protocol/TProtocol.cs
index ea3762c..70920d4 100644
--- a/lib/csharp/src/Protocol/TProtocol.cs
+++ b/lib/csharp/src/Protocol/TProtocol.cs
@@ -27,7 +27,7 @@
 
 namespace Thrift.Protocol
 {
-	public abstract class TProtocol
+	public abstract class TProtocol : IDisposable
 	{
 		protected TTransport trans;
 
@@ -41,6 +41,29 @@
 			get { return trans; }
 		}
 
+        #region " IDisposable Support "
+        private bool _IsDisposed;
+
+        // IDisposable
+        public void Dispose()
+        {
+            Dispose(true);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (!_IsDisposed)
+            {
+                if (disposing)
+                {
+                    if (trans is IDisposable)
+                        (trans as IDisposable).Dispose();
+                }
+            }
+            _IsDisposed = true;
+        }
+        #endregion
+
 		public abstract void WriteMessageBegin(TMessage message);
 		public abstract void WriteMessageEnd();
 		public abstract void WriteStructBegin(TStruct struc);