diff --git a/lib/csharp/src/Protocol/TAbstractBase.cs b/lib/csharp/src/Protocol/TAbstractBase.cs
index c0d5abe..f5a61cd 100644
--- a/lib/csharp/src/Protocol/TAbstractBase.cs
+++ b/lib/csharp/src/Protocol/TAbstractBase.cs
@@ -21,9 +21,9 @@
 {
     public interface TAbstractBase
     {
-        ///
-        /// Writes the objects out to the protocol
-        ///
+        /// <summary>
+        /// Writes the objects out to the protocol.
+        /// </summary>
         void Write(TProtocol tProtocol);
     }
 }
diff --git a/lib/csharp/src/Protocol/TBase.cs b/lib/csharp/src/Protocol/TBase.cs
index 350ff49..411e4d9 100644
--- a/lib/csharp/src/Protocol/TBase.cs
+++ b/lib/csharp/src/Protocol/TBase.cs
@@ -21,9 +21,9 @@
 {
     public interface TBase : TAbstractBase
     {
-        ///
+        /// <summary>
         /// Reads the TObject from the given input protocol.
-        ///
+        /// </summary>
         void Read(TProtocol tProtocol);
     }
 }
diff --git a/lib/csharp/src/Protocol/TBinaryProtocol.cs b/lib/csharp/src/Protocol/TBinaryProtocol.cs
index 4eceb86..a4faa94 100644
--- a/lib/csharp/src/Protocol/TBinaryProtocol.cs
+++ b/lib/csharp/src/Protocol/TBinaryProtocol.cs
@@ -36,29 +36,28 @@
         protected bool strictWrite_ = true;
 
         #region BinaryProtocol Factory
-         /**
-          * Factory
-          */
-          public class Factory : TProtocolFactory {
 
-              protected bool strictRead_ = false;
-              protected bool strictWrite_ = true;
+        public class Factory : TProtocolFactory
+        {
+            protected bool strictRead_ = false;
+            protected bool strictWrite_ = true;
 
-              public Factory()
-                  :this(false, true)
-              {
-              }
-
-              public Factory(bool strictRead, bool strictWrite)
-              {
-                  strictRead_ = strictRead;
-                  strictWrite_ = strictWrite;
-              }
-
-            public TProtocol GetProtocol(TTransport trans) {
-              return new TBinaryProtocol(trans, strictRead_, strictWrite_);
+            public Factory()
+                : this(false, true)
+            {
             }
-          }
+
+            public Factory(bool strictRead, bool strictWrite)
+            {
+                strictRead_ = strictRead;
+                strictWrite_ = strictWrite;
+            }
+
+            public TProtocol GetProtocol(TTransport trans)
+            {
+                return new TBinaryProtocol(trans, strictRead_, strictWrite_);
+            }
+        }
 
         #endregion
 
@@ -68,7 +67,7 @@
         }
 
         public TBinaryProtocol(TTransport trans, bool strictRead, bool strictWrite)
-            :base(trans)
+            : base(trans)
         {
             strictRead_ = strictRead;
             strictWrite_ = strictWrite;
@@ -345,16 +344,17 @@
         public override long ReadI64()
         {
             ReadAll(i64in, 0, 8);
-            unchecked {
-              return (long)(
-                  ((long)(i64in[0] & 0xff) << 56) |
-                  ((long)(i64in[1] & 0xff) << 48) |
-                  ((long)(i64in[2] & 0xff) << 40) |
-                  ((long)(i64in[3] & 0xff) << 32) |
-                  ((long)(i64in[4] & 0xff) << 24) |
-                  ((long)(i64in[5] & 0xff) << 16) |
-                  ((long)(i64in[6] & 0xff) << 8) |
-                  ((long)(i64in[7] & 0xff)));
+            unchecked
+            {
+                return (long)(
+                    ((long)(i64in[0] & 0xff) << 56) |
+                    ((long)(i64in[1] & 0xff) << 48) |
+                    ((long)(i64in[2] & 0xff) << 40) |
+                    ((long)(i64in[3] & 0xff) << 32) |
+                    ((long)(i64in[4] & 0xff) << 24) |
+                    ((long)(i64in[5] & 0xff) << 16) |
+                    ((long)(i64in[6] & 0xff) << 8) |
+                    ((long)(i64in[7] & 0xff)));
             }
         }
 
@@ -378,7 +378,7 @@
             trans.ReadAll(buf, 0, size);
             return buf;
         }
-        private  string ReadStringBody(int size)
+        private string ReadStringBody(int size)
         {
             byte[] buf = new byte[size];
             trans.ReadAll(buf, 0, size);
diff --git a/lib/csharp/src/Protocol/TCompactProtocol.cs b/lib/csharp/src/Protocol/TCompactProtocol.cs
index 2b4f6f1..ff67397 100644
--- a/lib/csharp/src/Protocol/TCompactProtocol.cs
+++ b/lib/csharp/src/Protocol/TCompactProtocol.cs
@@ -44,9 +44,9 @@
         private const byte TYPE_BITS = 0x07; // 0000 0111
         private const int TYPE_SHIFT_AMOUNT = 5;
 
-        /**
-         * All of the on-wire type codes.
-         */
+        /// <summary>
+        /// All of the on-wire type codes.
+        /// </summary>
         private static class Types
         {
             public const byte STOP = 0x00;
@@ -64,32 +64,29 @@
             public const byte STRUCT = 0x0C;
         }
 
-        /**
-         * Used to keep track of the last field for the current and previous structs,
-         * so we can do the delta stuff.
-         */
+        /// <summary>
+        /// Used to keep track of the last field for the current and previous structs,
+        /// so we can do the delta stuff.
+        /// </summary>
         private Stack<short> lastField_ = new Stack<short>(15);
 
         private short lastFieldId_ = 0;
 
-        /**
-         * If we encounter a boolean field begin, save the TField here so it can
-         * have the value incorporated.
-         */
+        /// <summary>
+        /// If we encounter a boolean field begin, save the TField here so it can
+        /// have the value incorporated.
+        /// </summary>
         private Nullable<TField> booleanField_;
 
-        /**
-         * If we Read a field header, and it's a boolean field, save the boolean
-         * value here so that ReadBool can use it.
-         */
-        private  Nullable<Boolean> boolValue_;
+        /// <summary>
+        /// If we Read a field header, and it's a boolean field, save the boolean
+        /// value here so that ReadBool can use it.
+        /// </summary>
+        private Nullable<Boolean> boolValue_;
 
 
         #region CompactProtocol Factory
 
-        /**
-          * Factory
-          */
         public class Factory : TProtocolFactory
         {
             public Factory() { }
@@ -127,31 +124,32 @@
 
         #region Write Methods
 
-
-        /**
-         * Writes a byte without any possibility of all that field header nonsense.
-         * Used internally by other writing methods that know they need to Write a byte.
-         */
+        /// <summary>
+        /// Writes a byte without any possibility of all that field header nonsense.
+        /// Used internally by other writing methods that know they need to Write a byte.
+        /// </summary>
         private byte[] byteDirectBuffer = new byte[1];
+
         private void WriteByteDirect(byte b)
         {
             byteDirectBuffer[0] = b;
             trans.Write(byteDirectBuffer);
         }
 
-        /**
-         * Writes a byte without any possibility of all that field header nonsense.
-         */
+        /// <summary>
+        /// Writes a byte without any possibility of all that field header nonsense.
+        /// </summary>
         private void WriteByteDirect(int n)
         {
             WriteByteDirect((byte)n);
         }
 
-        /**
-         * Write an i32 as a varint. Results in 1-5 bytes on the wire.
-         * TODO: make a permanent buffer like WriteVarint64?
-         */
+        /// <summary>
+        /// Write an i32 as a varint. Results in 1-5 bytes on the wire.
+        /// TODO: make a permanent buffer like WriteVarint64?
+        /// </summary>
         byte[] i32buf = new byte[5];
+
         private void WriteVarint32(uint n)
         {
             int idx = 0;
@@ -174,10 +172,10 @@
             trans.Write(i32buf, 0, idx);
         }
 
-        /**
-        * Write a message header to the wire. Compact Protocol messages contain the
-        * protocol version so we can migrate forwards in the future if need be.
-        */
+        /// <summary>
+        /// Write a message header to the wire. Compact Protocol messages contain the
+        /// protocol version so we can migrate forwards in the future if need be.
+        /// </summary>
         public override void WriteMessageBegin(TMessage message)
         {
             WriteByteDirect(PROTOCOL_ID);
@@ -186,33 +184,33 @@
             WriteString(message.Name);
         }
 
-        /**
-         * Write a struct begin. This doesn't actually put anything on the wire. We
-         * use it as an opportunity to put special placeholder markers on the field
-         * stack so we can get the field id deltas correct.
-         */
+        /// <summary>
+        /// Write a struct begin. This doesn't actually put anything on the wire. We
+        /// use it as an opportunity to put special placeholder markers on the field
+        /// stack so we can get the field id deltas correct.
+        /// </summary>
         public override void WriteStructBegin(TStruct strct)
         {
             lastField_.Push(lastFieldId_);
             lastFieldId_ = 0;
         }
 
-        /**
-         * Write a struct end. This doesn't actually put anything on the wire. We use
-         * this as an opportunity to pop the last field from the current struct off
-         * of the field stack.
-         */
+        /// <summary>
+        /// Write a struct end. This doesn't actually put anything on the wire. We use
+        /// this as an opportunity to pop the last field from the current struct off
+        /// of the field stack.
+        /// </summary>
         public override void WriteStructEnd()
         {
             lastFieldId_ = lastField_.Pop();
         }
 
-        /**
-         * Write a field header containing the field id and field type. If the
-         * difference between the current field id and the last one is small (< 15),
-         * then the field id will be encoded in the 4 MSB as a delta. Otherwise, the
-         * field id will follow the type header as a zigzag varint.
-         */
+        /// <summary>
+        /// Write a field header containing the field id and field type. If the
+        /// difference between the current field id and the last one is small (&lt; 15),
+        /// then the field id will be encoded in the 4 MSB as a delta. Otherwise, the
+        /// field id will follow the type header as a zigzag varint.
+        /// </summary>
         public override void WriteFieldBegin(TField field)
         {
             if (field.Type == TType.Bool)
@@ -226,11 +224,11 @@
             }
         }
 
-        /**
-         * The workhorse of WriteFieldBegin. It has the option of doing a
-         * 'type override' of the type header. This is used specifically in the
-         * boolean field case.
-         */
+        /// <summary>
+        /// The workhorse of WriteFieldBegin. It has the option of doing a
+        /// 'type override' of the type header. This is used specifically in the
+        /// boolean field case.
+        /// </summary>
         private void WriteFieldBeginInternal(TField field, byte typeOverride)
         {
             // short lastField = lastField_.Pop();
@@ -255,18 +253,18 @@
             // lastField_.push(field.id);
         }
 
-        /**
-         * Write the STOP symbol so we know there are no more fields in this struct.
-         */
+        /// <summary>
+        /// Write the STOP symbol so we know there are no more fields in this struct.
+        /// </summary>
         public override void WriteFieldStop()
         {
             WriteByteDirect(Types.STOP);
         }
 
-        /**
-         * Write a map header. If the map is empty, omit the key and value type
-         * headers, as we don't need any additional information to skip it.
-         */
+        /// <summary>
+        /// Write a map header. If the map is empty, omit the key and value type
+        /// headers, as we don't need any additional information to skip it.
+        /// </summary>
         public override void WriteMapBegin(TMap map)
         {
             if (map.Count == 0)
@@ -280,28 +278,28 @@
             }
         }
 
-        /**
-         * Write a list header.
-         */
+        /// <summary>
+        /// Write a list header.
+        /// </summary>
         public override void WriteListBegin(TList list)
         {
             WriteCollectionBegin(list.ElementType, list.Count);
         }
 
-        /**
-         * Write a set header.
-         */
+        /// <summary>
+        /// Write a set header.
+        /// </summary>
         public override void WriteSetBegin(TSet set)
         {
             WriteCollectionBegin(set.ElementType, set.Count);
         }
 
-        /**
-         * Write a boolean value. Potentially, this could be a boolean field, in
-         * which case the field header info isn't written yet. If so, decide what the
-         * right type header is for the value and then Write the field header.
-         * Otherwise, Write a single byte.
-         */
+        /// <summary>
+        /// Write a boolean value. Potentially, this could be a boolean field, in
+        /// which case the field header info isn't written yet. If so, decide what the
+        /// right type header is for the value and then Write the field header.
+        /// Otherwise, Write a single byte.
+        /// </summary>
         public override void WriteBool(Boolean b)
         {
             if (booleanField_ != null)
@@ -317,41 +315,41 @@
             }
         }
 
-        /**
-         * Write a byte. Nothing to see here!
-         */
+        /// <summary>
+        /// Write a byte. Nothing to see here!
+        /// </summary>
         public override void WriteByte(sbyte b)
         {
             WriteByteDirect((byte)b);
         }
 
-        /**
-         * Write an I16 as a zigzag varint.
-         */
+        /// <summary>
+        /// Write an I16 as a zigzag varint.
+        /// </summary>
         public override void WriteI16(short i16)
         {
             WriteVarint32(intToZigZag(i16));
         }
 
-        /**
-         * Write an i32 as a zigzag varint.
-         */
+        /// <summary>
+        /// Write an i32 as a zigzag varint.
+        /// </summary>
         public override void WriteI32(int i32)
         {
             WriteVarint32(intToZigZag(i32));
         }
 
-        /**
-         * Write an i64 as a zigzag varint.
-         */
+        /// <summary>
+        /// Write an i64 as a zigzag varint.
+        /// </summary>
         public override void WriteI64(long i64)
         {
             WriteVarint64(longToZigzag(i64));
         }
 
-        /**
-         * Write a double to the wire as 8 bytes.
-         */
+        /// <summary>
+        /// Write a double to the wire as 8 bytes.
+        /// </summary>
         public override void WriteDouble(double dub)
         {
             byte[] data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -359,18 +357,18 @@
             trans.Write(data);
         }
 
-        /**
-         * Write a string to the wire with a varint size preceding.
-         */
-        public override void WriteString(String str)
+        /// <summary>
+        /// Write a string to the wire with a varint size preceding.
+        /// </summary>
+        public override void WriteString(string str)
         {
             byte[] bytes = UTF8Encoding.UTF8.GetBytes(str);
             WriteBinary(bytes, 0, bytes.Length);
         }
 
-        /**
-         * Write a byte array, using a varint for the size.
-         */
+        /// <summary>
+        /// Write a byte array, using a varint for the size.
+        /// </summary>
         public override void WriteBinary(byte[] bin)
         {
             WriteBinary(bin, 0, bin.Length);
@@ -397,10 +395,10 @@
         // Internal writing methods
         //
 
-        /**
-         * Abstract method for writing the start of lists and sets. List and sets on
-         * the wire differ only by the type indicator.
-         */
+        /// <summary>
+        /// Abstract method for writing the start of lists and sets. List and sets on
+        /// the wire differ only by the type indicator.
+        /// </summary>
         protected void WriteCollectionBegin(TType elemType, int size)
         {
             if (size <= 14)
@@ -414,9 +412,9 @@
             }
         }
 
-        /**
-         * Write an i64 as a varint. Results in 1-10 bytes on the wire.
-         */
+        /// <summary>
+        /// Write an i64 as a varint. Results in 1-10 bytes on the wire.
+        /// </summary>
         byte[] varint64out = new byte[10];
         private void WriteVarint64(ulong n)
         {
@@ -437,28 +435,28 @@
             trans.Write(varint64out, 0, idx);
         }
 
-        /**
-         * Convert l into a zigzag long. This allows negative numbers to be
-         * represented compactly as a varint.
-         */
+        /// <summary>
+        /// Convert l into a zigzag long. This allows negative numbers to be
+        /// represented compactly as a varint.
+        /// </summary>
         private ulong longToZigzag(long n)
         {
             return (ulong)(n << 1) ^ (ulong)(n >> 63);
         }
 
-        /**
-         * Convert n into a zigzag int. This allows negative numbers to be
-         * represented compactly as a varint.
-         */
+        /// <summary>
+        /// Convert n into a zigzag int. This allows negative numbers to be
+        /// represented compactly as a varint.
+        /// </summary>
         private uint intToZigZag(int n)
         {
             return (uint)(n << 1) ^ (uint)(n >> 31);
         }
 
-        /**
-         * Convert a long into little-endian bytes in buf starting at off and going
-         * until off+7.
-         */
+        /// <summary>
+        /// Convert a long into little-endian bytes in buf starting at off and going
+        /// until off+7.
+        /// </summary>
         private void fixedLongToBytes(long n, byte[] buf, int off)
         {
             buf[off + 0] = (byte)(n & 0xff);
@@ -475,9 +473,9 @@
 
         #region ReadMethods
 
-        /**
-   * Read a message header.
-   */
+        /// <summary>
+        /// Read a message header.
+        /// </summary>
         public override TMessage ReadMessageBegin()
         {
             byte protocolId = (byte)ReadByte();
@@ -493,14 +491,14 @@
             }
             byte type = (byte)((versionAndType >> TYPE_SHIFT_AMOUNT) & TYPE_BITS);
             int seqid = (int)ReadVarint32();
-            String messageName = ReadString();
+            string messageName = ReadString();
             return new TMessage(messageName, (TMessageType)type, seqid);
         }
 
-        /**
-         * Read a struct begin. There's nothing on the wire for this, but it is our
-         * opportunity to push a new struct begin marker onto the field stack.
-         */
+        /// <summary>
+        /// Read a struct begin. There's nothing on the wire for this, but it is our
+        /// opportunity to push a new struct begin marker onto the field stack.
+        /// </summary>
         public override TStruct ReadStructBegin()
         {
             lastField_.Push(lastFieldId_);
@@ -508,19 +506,19 @@
             return ANONYMOUS_STRUCT;
         }
 
-        /**
-         * Doesn't actually consume any wire data, just removes the last field for
-         * this struct from the field stack.
-         */
+        /// <summary>
+        /// Doesn't actually consume any wire data, just removes the last field for
+        /// this struct from the field stack.
+        /// </summary>
         public override void ReadStructEnd()
         {
             // consume the last field we Read off the wire.
             lastFieldId_ = lastField_.Pop();
         }
 
-        /**
-         * Read a field header off the wire.
-         */
+        /// <summary>
+        /// Read a field header off the wire.
+        /// </summary>
         public override TField ReadFieldBegin()
         {
             byte type = (byte)ReadByte();
@@ -560,11 +558,11 @@
             return field;
         }
 
-        /**
-         * Read a map header off the wire. If the size is zero, skip Reading the key
-         * and value type. This means that 0-length maps will yield TMaps without the
-         * "correct" types.
-         */
+        /// <summary>
+        /// Read a map header off the wire. If the size is zero, skip Reading the key
+        /// and value type. This means that 0-length maps will yield TMaps without the
+        /// "correct" types.
+        /// </summary>
         public override TMap ReadMapBegin()
         {
             int size = (int)ReadVarint32();
@@ -572,12 +570,12 @@
             return new TMap(getTType((byte)(keyAndValueType >> 4)), getTType((byte)(keyAndValueType & 0xf)), size);
         }
 
-        /**
-         * Read a list header off the wire. If the list size is 0-14, the size will
-         * be packed into the element type header. If it's a longer list, the 4 MSB
-         * of the element type header will be 0xF, and a varint will follow with the
-         * true size.
-         */
+        /// <summary>
+        /// Read a list header off the wire. If the list size is 0-14, the size will
+        /// be packed into the element type header. If it's a longer list, the 4 MSB
+        /// of the element type header will be 0xF, and a varint will follow with the
+        /// true size.
+        /// </summary>
         public override TList ReadListBegin()
         {
             byte size_and_type = (byte)ReadByte();
@@ -590,22 +588,22 @@
             return new TList(type, size);
         }
 
-        /**
-         * Read a set header off the wire. If the set size is 0-14, the size will
-         * be packed into the element type header. If it's a longer set, the 4 MSB
-         * of the element type header will be 0xF, and a varint will follow with the
-         * true size.
-         */
+        /// <summary>
+        /// Read a set header off the wire. If the set size is 0-14, the size will
+        /// be packed into the element type header. If it's a longer set, the 4 MSB
+        /// of the element type header will be 0xF, and a varint will follow with the
+        /// true size.
+        /// </summary>
         public override TSet ReadSetBegin()
         {
             return new TSet(ReadListBegin());
         }
 
-        /**
-         * Read a boolean off the wire. If this is a boolean field, the value should
-         * already have been Read during ReadFieldBegin, so we'll just consume the
-         * pre-stored value. Otherwise, Read a byte.
-         */
+        /// <summary>
+        /// Read a boolean off the wire. If this is a boolean field, the value should
+        /// already have been Read during ReadFieldBegin, so we'll just consume the
+        /// pre-stored value. Otherwise, Read a byte.
+        /// </summary>
         public override Boolean ReadBool()
         {
             if (boolValue_ != null)
@@ -618,42 +616,42 @@
         }
 
         byte[] byteRawBuf = new byte[1];
-        /**
-         * Read a single byte off the wire. Nothing interesting here.
-         */
+        /// <summary>
+        /// Read a single byte off the wire. Nothing interesting here.
+        /// </summary>
         public override sbyte ReadByte()
         {
             trans.ReadAll(byteRawBuf, 0, 1);
             return (sbyte)byteRawBuf[0];
         }
 
-        /**
-         * Read an i16 from the wire as a zigzag varint.
-         */
+        /// <summary>
+        /// Read an i16 from the wire as a zigzag varint.
+        /// </summary>
         public override short ReadI16()
         {
             return (short)zigzagToInt(ReadVarint32());
         }
 
-        /**
-         * Read an i32 from the wire as a zigzag varint.
-         */
+        /// <summary>
+        /// Read an i32 from the wire as a zigzag varint.
+        /// </summary>
         public override int ReadI32()
         {
             return zigzagToInt(ReadVarint32());
         }
 
-        /**
-         * Read an i64 from the wire as a zigzag varint.
-         */
+        /// <summary>
+        /// Read an i64 from the wire as a zigzag varint.
+        /// </summary>
         public override long ReadI64()
         {
             return zigzagToLong(ReadVarint64());
         }
 
-        /**
-         * No magic here - just Read a double off the wire.
-         */
+        /// <summary>
+        /// No magic here - just Read a double off the wire.
+        /// </summary>
         public override double ReadDouble()
         {
             byte[] longBits = new byte[8];
@@ -661,10 +659,10 @@
             return BitConverter.Int64BitsToDouble(bytesToLong(longBits));
         }
 
-        /**
-         * Reads a byte[] (via ReadBinary), and then UTF-8 decodes it.
-         */
-        public override String ReadString()
+        /// <summary>
+        /// Reads a byte[] (via ReadBinary), and then UTF-8 decodes it.
+        /// </summary>
+        public override string ReadString()
         {
             int length = (int)ReadVarint32();
 
@@ -676,9 +674,9 @@
             return Encoding.UTF8.GetString(ReadBinary(length));
         }
 
-        /**
-         * Read a byte[] from the wire.
-         */
+        /// <summary>
+        /// Read a byte[] from the wire.
+        /// </summary>
         public override byte[] ReadBinary()
         {
             int length = (int)ReadVarint32();
@@ -689,9 +687,9 @@
             return buf;
         }
 
-        /**
-         * Read a byte[] of a known length from the wire.
-         */
+        /// <summary>
+        /// Read a byte[] of a known length from the wire.
+        /// </summary>
         private byte[] ReadBinary(int length)
         {
             if (length == 0) return new byte[0];
@@ -715,10 +713,10 @@
         // Internal Reading methods
         //
 
-        /**
-         * Read an i32 from the wire as a varint. The MSB of each byte is set
-         * if there is another byte to follow. This can Read up to 5 bytes.
-         */
+        /// <summary>
+        /// Read an i32 from the wire as a varint. The MSB of each byte is set
+        /// if there is another byte to follow. This can Read up to 5 bytes.
+        /// </summary>
         private uint ReadVarint32()
         {
             uint result = 0;
@@ -733,10 +731,10 @@
             return result;
         }
 
-        /**
-         * Read an i64 from the wire as a proper varint. The MSB of each byte is set
-         * if there is another byte to follow. This can Read up to 10 bytes.
-         */
+        /// <summary>
+        /// Read an i64 from the wire as a proper varint. The MSB of each byte is set
+        /// if there is another byte to follow. This can Read up to 10 bytes.
+        /// </summary>
         private ulong ReadVarint64()
         {
             int shift = 0;
@@ -758,27 +756,27 @@
         // encoding helpers
         //
 
-        /**
-         * Convert from zigzag int to int.
-         */
+        /// <summary>
+        /// Convert from zigzag int to int.
+        /// </summary>
         private int zigzagToInt(uint n)
         {
             return (int)(n >> 1) ^ (-(int)(n & 1));
         }
 
-        /**
-         * Convert from zigzag long to long.
-         */
+        /// <summary>
+        /// Convert from zigzag long to long.
+        /// </summary>
         private long zigzagToLong(ulong n)
         {
             return (long)(n >> 1) ^ (-(long)(n & 1));
         }
 
-        /**
-         * Note that it's important that the mask bytes are long literals,
-         * otherwise they'll default to ints, and when you shift an int left 56 bits,
-         * you just get a messed up int.
-         */
+        /// <summary>
+        /// Note that it's important that the mask bytes are long literals,
+        /// otherwise they'll default to ints, and when you shift an int left 56 bits,
+        /// you just get a messed up int.
+        /// </summary>
         private long bytesToLong(byte[] bytes)
         {
             return
@@ -802,10 +800,10 @@
             return lowerNibble == Types.BOOLEAN_TRUE || lowerNibble == Types.BOOLEAN_FALSE;
         }
 
-        /**
-         * Given a TCompactProtocol.Types constant, convert it to its corresponding
-         * TType value.
-         */
+        /// <summary>
+        /// Given a TCompactProtocol.Types constant, convert it to its corresponding
+        /// TType value.
+        /// </summary>
         private TType getTType(byte type)
         {
             switch ((byte)(type & 0x0f))
@@ -840,9 +838,9 @@
             }
         }
 
-        /**
-         * Given a TType value, find the appropriate TCompactProtocol.Types constant.
-         */
+        /// <summary>
+        /// Given a TType value, find the appropriate TCompactProtocol.Types constant.
+        /// </summary>
         private byte getCompactType(TType ttype)
         {
             return ttypeToCompactType[(int)ttype];
diff --git a/lib/csharp/src/Protocol/TJSONProtocol.cs b/lib/csharp/src/Protocol/TJSONProtocol.cs
index 0ceb675..3390dc0 100644
--- a/lib/csharp/src/Protocol/TJSONProtocol.cs
+++ b/lib/csharp/src/Protocol/TJSONProtocol.cs
@@ -29,18 +29,18 @@
 {
     /// <summary>
     /// JSON protocol implementation for thrift.
-    ///
+    /// <para/>
     /// This is a full-featured protocol supporting Write and Read.
-    ///
+    /// <para/>
     /// Please see the C++ class header for a detailed description of the
     /// protocol's wire format.
-    ///
+    /// <para/>
     /// Adapted from the Java version.
     /// </summary>
     public class TJSONProtocol : TProtocol
     {
         /// <summary>
-        /// Factory for JSON protocol objects
+        /// Factory for JSON protocol objects.
         /// </summary>
         public class Factory : TProtocolFactory
         {
@@ -179,11 +179,11 @@
             return result;
         }
 
-        ///<summary>
+        /// <summary>
         /// Base class for tracking JSON contexts that may require
         /// inserting/Reading additional JSON syntax characters
         /// This base context does nothing.
-        ///</summary>
+        /// </summary>
         protected class JSONBaseContext
         {
             protected TJSONProtocol proto;
@@ -200,10 +200,10 @@
             public virtual bool EscapeNumbers() { return false; }
         }
 
-        ///<summary>
+        /// <summary>
         /// Context for JSON lists. Will insert/Read commas before each item except
         /// for the first one
-        ///</summary>
+        /// </summary>
         protected class JSONListContext : JSONBaseContext
         {
             public JSONListContext(TJSONProtocol protocol)
@@ -239,12 +239,12 @@
             }
         }
 
-        ///<summary>
+        /// <summary>
         /// Context for JSON records. Will insert/Read colons before the value portion
         /// of each record pair, and commas before each key except the first. In
         /// addition, will indicate that numbers in the key position need to be
         /// escaped in quotes (since JSON keys must be strings).
-        ///</summary>
+        /// </summary>
         protected class JSONPairContext : JSONBaseContext
         {
             public JSONPairContext(TJSONProtocol proto)
@@ -290,9 +290,9 @@
             }
         }
 
-        ///<summary>
+        /// <summary>
         /// Holds up to one byte from the transport
-        ///</summary>
+        /// </summary>
         protected class LookaheadReader
         {
             protected TJSONProtocol proto;
@@ -305,10 +305,10 @@
             private bool hasData;
             private byte[] data = new byte[1];
 
-            ///<summary>
+            /// <summary>
             /// Return and consume the next byte to be Read, either taking it from the
             /// data buffer if present or getting it from the transport otherwise.
-            ///</summary>
+            /// </summary>
             public byte Read()
             {
                 if (hasData)
@@ -322,10 +322,10 @@
                 return data[0];
             }
 
-            ///<summary>
+            /// <summary>
             /// Return the next byte to be Read without consuming, filling the data
             /// buffer if it has not been filled alReady.
-            ///</summary>
+            /// </summary>
             public byte Peek()
             {
                 if (!hasData)
@@ -349,26 +349,26 @@
         // Reader that manages a 1-byte buffer
         protected LookaheadReader reader;
 
-        ///<summary>
+        /// <summary>
         /// Push a new JSON context onto the stack.
-        ///</summary>
+        /// </summary>
         protected void PushContext(JSONBaseContext c)
         {
             contextStack.Push(context);
             context = c;
         }
 
-        ///<summary>
+        /// <summary>
         /// Pop the last JSON context off the stack
-        ///</summary>
+        /// </summary>
         protected void PopContext()
         {
             context = contextStack.Pop();
         }
 
-        ///<summary>
+        /// <summary>
         /// TJSONProtocol Constructor
-        ///</summary>
+        /// </summary>
         public TJSONProtocol(TTransport trans)
             : base(trans)
         {
@@ -379,11 +379,11 @@
         // Temporary buffer used by several methods
         private byte[] tempBuffer = new byte[4];
 
-        ///<summary>
+        /// <summary>
         /// Read a byte that must match b[0]; otherwise an exception is thrown.
         /// Marked protected to avoid synthetic accessor in JSONListContext.Read
         /// and JSONPairContext.Read
-        ///</summary>
+        /// </summary>
         protected void ReadJSONSyntaxChar(byte[] b)
         {
             byte ch = reader.Read();
@@ -394,10 +394,10 @@
             }
         }
 
-        ///<summary>
+        /// <summary>
         /// Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its
         /// corresponding hex value
-        ///</summary>
+        /// </summary>
         private static byte HexVal(byte ch)
         {
             if ((ch >= '0') && (ch <= '9'))
@@ -416,9 +416,9 @@
             }
         }
 
-        ///<summary>
+        /// <summary>
         /// Convert a byte containing a hex value to its corresponding hex character
-        ///</summary>
+        /// </summary>
         private static byte HexChar(byte val)
         {
             val &= 0x0F;
@@ -433,9 +433,9 @@
             }
         }
 
-        ///<summary>
+        /// <summary>
         /// Write the bytes in array buf as a JSON characters, escaping as needed
-        ///</summary>
+        /// </summary>
         private void WriteJSONString(byte[] b)
         {
             context.Write();
@@ -479,14 +479,14 @@
             trans.Write(QUOTE);
         }
 
-        ///<summary>
+        /// <summary>
         /// Write out number as a JSON value. If the context dictates so, it will be
         /// wrapped in quotes to output as a JSON string.
-        ///</summary>
+        /// </summary>
         private void WriteJSONInteger(long num)
         {
             context.Write();
-            String str = num.ToString();
+            string str = num.ToString();
 
             bool escapeNum = context.EscapeNumbers();
             if (escapeNum)
@@ -498,14 +498,14 @@
                 trans.Write(QUOTE);
         }
 
-        ///<summary>
+        /// <summary>
         /// Write out a double as a JSON value. If it is NaN or infinity or if the
         /// context dictates escaping, Write out as JSON string.
-        ///</summary>
+        /// </summary>
         private void WriteJSONDouble(double num)
         {
             context.Write();
-            String str = num.ToString("G17", CultureInfo.InvariantCulture);
+            string str = num.ToString("G17", CultureInfo.InvariantCulture);
             bool special = false;
 
             switch (str[0])
@@ -532,10 +532,10 @@
             if (escapeNum)
                 trans.Write(QUOTE);
         }
-        ///<summary>
+        /// <summary>
         /// Write out contents of byte array b as a JSON string with base-64 encoded
         /// data
-        ///</summary>
+        /// </summary>
         private void WriteJSONBase64(byte[] b)
         {
             context.Write();
@@ -698,7 +698,7 @@
             WriteJSONDouble(dub);
         }
 
-        public override void WriteString(String str)
+        public override void WriteString(string str)
         {
             byte[] b = utf8Encoding.GetBytes(str);
             WriteJSONString(b);
@@ -713,10 +713,10 @@
          * Reading methods.
          */
 
-        ///<summary>
+        /// <summary>
         /// Read in a JSON string, unescaping as appropriate.. Skip Reading from the
         /// context if skipContext is true.
-        ///</summary>
+        /// </summary>
         private byte[] ReadJSONString(bool skipContext)
         {
             MemoryStream buffer = new MemoryStream();
@@ -803,9 +803,9 @@
             return buffer.ToArray();
         }
 
-        ///<summary>
+        /// <summary>
         /// Return true if the given byte could be a valid part of a JSON number.
-        ///</summary>
+        /// </summary>
         private bool IsJSONNumeric(byte b)
         {
             switch (b)
@@ -830,11 +830,11 @@
             return false;
         }
 
-        ///<summary>
+        /// <summary>
         /// Read in a sequence of characters that are all valid in JSON numbers. Does
         /// not do a complete regex check to validate that this is actually a number.
-        ////</summary>
-        private String ReadJSONNumericChars()
+        /// </summary>
+        private string ReadJSONNumericChars()
         {
             StringBuilder strbld = new StringBuilder();
             while (true)
@@ -849,9 +849,9 @@
             return strbld.ToString();
         }
 
-        ///<summary>
+        /// <summary>
         /// Read in a JSON number. If the context dictates, Read in enclosing quotes.
-        ///</summary>
+        /// </summary>
         private long ReadJSONInteger()
         {
             context.Read();
@@ -859,7 +859,7 @@
             {
                 ReadJSONSyntaxChar(QUOTE);
             }
-            String str = ReadJSONNumericChars();
+            string str = ReadJSONNumericChars();
             if (context.EscapeNumbers())
             {
                 ReadJSONSyntaxChar(QUOTE);
@@ -875,17 +875,17 @@
             }
         }
 
-        ///<summary>
+        /// <summary>
         /// Read in a JSON double value. Throw if the value is not wrapped in quotes
         /// when expected or if wrapped in quotes when not expected.
-        ///</summary>
+        /// </summary>
         private double ReadJSONDouble()
         {
             context.Read();
             if (reader.Peek() == QUOTE[0])
             {
                 byte[] arr = ReadJSONString(true);
-                double dub = Double.Parse(utf8Encoding.GetString(arr,0,arr.Length), CultureInfo.InvariantCulture);
+                double dub = Double.Parse(utf8Encoding.GetString(arr, 0, arr.Length), CultureInfo.InvariantCulture);
 
                 if (!context.EscapeNumbers() && !Double.IsNaN(dub) &&
                     !Double.IsInfinity(dub))
@@ -915,9 +915,9 @@
             }
         }
 
-        //<summary>
+        /// <summary>
         /// Read in a JSON string containing base-64 encoded data and decode it.
-        ///</summary>
+        /// </summary>
         private byte[] ReadJSONBase64()
         {
             byte[] b = ReadJSONString(false);
@@ -989,7 +989,7 @@
             }
 
             var buf = ReadJSONString(false);
-            message.Name = utf8Encoding.GetString(buf,0,buf.Length);
+            message.Name = utf8Encoding.GetString(buf, 0, buf.Length);
             message.Type = (TMessageType)ReadJSONInteger();
             message.SeqID = (int)ReadJSONInteger();
             return message;
@@ -1108,10 +1108,10 @@
             return ReadJSONDouble();
         }
 
-        public override String ReadString()
+        public override string ReadString()
         {
             var buf = ReadJSONString(false);
-            return utf8Encoding.GetString(buf,0,buf.Length);
+            return utf8Encoding.GetString(buf, 0, buf.Length);
         }
 
         public override byte[] ReadBinary()
diff --git a/lib/csharp/src/Protocol/TMultiplexedProcessor.cs b/lib/csharp/src/Protocol/TMultiplexedProcessor.cs
index 35d138c..aa91c52 100644
--- a/lib/csharp/src/Protocol/TMultiplexedProcessor.cs
+++ b/lib/csharp/src/Protocol/TMultiplexedProcessor.cs
@@ -29,74 +29,77 @@
 
 namespace Thrift.Protocol
 {
-
-    /**
-     * TMultiplexedProcessor is a TProcessor allowing a single TServer to provide multiple services.
-     * To do so, you instantiate the processor and then register additional processors with it,
-     * as shown in the following example:
-     *
-     *     TMultiplexedProcessor processor = new TMultiplexedProcessor();
-     *
-     *     processor.registerProcessor(
-     *         "Calculator",
-     *         new Calculator.Processor(new CalculatorHandler()));
-     *
-     *     processor.registerProcessor(
-     *         "WeatherReport",
-     *         new WeatherReport.Processor(new WeatherReportHandler()));
-     *
-     *     TServerTransport t = new TServerSocket(9090);
-     *     TSimpleServer server = new TSimpleServer(processor, t);
-     *
-     *     server.serve();
-     */
+    /// <summary>
+    /// <see cref="TMultiplexedProcessor"/> is a <see cref="TProcessor"/> allowing a single <see cref="Thrift.Server.TServer"/>
+    /// to provide multiple services.
+    /// <para/>
+    /// To do so, you instantiate the processor and then register additional processors with it,
+    /// as shown in the following example:
+    /// <para/>
+    /// <code>
+    ///     TMultiplexedProcessor processor = new TMultiplexedProcessor();
+    ///
+    ///     processor.registerProcessor(
+    ///         "Calculator",
+    ///         new Calculator.Processor(new CalculatorHandler()));
+    ///
+    ///     processor.registerProcessor(
+    ///         "WeatherReport",
+    ///         new WeatherReport.Processor(new WeatherReportHandler()));
+    ///
+    ///     TServerTransport t = new TServerSocket(9090);
+    ///     TSimpleServer server = new TSimpleServer(processor, t);
+    ///
+    ///     server.serve();
+    /// </code>
+    /// </summary>
     public class TMultiplexedProcessor : TProcessor
     {
-        private Dictionary<String,TProcessor> ServiceProcessorMap = new Dictionary<String,TProcessor>();
+        private Dictionary<string, TProcessor> ServiceProcessorMap = new Dictionary<string, TProcessor>();
 
-        /**
-         * 'Register' a service with this TMultiplexedProcessor. This allows us to broker
-         * requests to individual services by using the service name to select them at request time.
-         *
-         * Args:
-         * - serviceName    Name of a service, has to be identical to the name
-         *                  declared in the Thrift IDL, e.g. "WeatherReport".
-         * - processor      Implementation of a service, usually referred to as "handlers",
-         *                  e.g. WeatherReportHandler implementing WeatherReport.Iface.
-         */
-        public void RegisterProcessor(String serviceName, TProcessor processor)
+        /// <summary>
+        /// 'Register' a service with this TMultiplexedProcessor. This allows us to broker
+        /// requests to individual services by using the service name to select them at request time.
+        ///
+        /// Args:
+        /// - serviceName    Name of a service, has to be identical to the name
+        ///                  declared in the Thrift IDL, e.g. "WeatherReport".
+        /// - processor      Implementation of a service, usually referred to as "handlers",
+        ///                  e.g. WeatherReportHandler implementing WeatherReport.Iface.
+        /// </summary>
+        public void RegisterProcessor(string serviceName, TProcessor processor)
         {
             ServiceProcessorMap.Add(serviceName, processor);
         }
 
 
-        private void Fail( TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype, string etxt)
+        private void Fail(TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype, string etxt)
         {
-            TApplicationException appex = new TApplicationException( extype, etxt);
+            TApplicationException appex = new TApplicationException(extype, etxt);
 
             TMessage newMessage = new TMessage(message.Name, TMessageType.Exception, message.SeqID);
 
             oprot.WriteMessageBegin(newMessage);
-            appex.Write( oprot);
+            appex.Write(oprot);
             oprot.WriteMessageEnd();
             oprot.Transport.Flush();
         }
 
 
-        /**
-         * This implementation of process performs the following steps:
-         *
-         * - Read the beginning of the message.
-         * - Extract the service name from the message.
-         * - Using the service name to locate the appropriate processor.
-         * - Dispatch to the processor, with a decorated instance of TProtocol
-         *    that allows readMessageBegin() to return the original TMessage.
-         *
-         * Throws an exception if
-         * - the message type is not CALL or ONEWAY,
-         * - the service name was not found in the message, or
-         * - the service name has not been RegisterProcessor()ed.
-         */
+        /// <summary>
+        /// This implementation of process performs the following steps:
+        ///
+        /// - Read the beginning of the message.
+        /// - Extract the service name from the message.
+        /// - Using the service name to locate the appropriate processor.
+        /// - Dispatch to the processor, with a decorated instance of TProtocol
+        ///    that allows readMessageBegin() to return the original TMessage.
+        /// <para/>
+        /// Throws an exception if
+        /// - the message type is not CALL or ONEWAY,
+        /// - the service name was not found in the message, or
+        /// - the service name has not been RegisterProcessor()ed.
+        /// </summary>
         public bool Process(TProtocol iprot, TProtocol oprot)
         {
             /*  Use the actual underlying protocol (e.g. TBinaryProtocol) to read the
@@ -155,17 +158,17 @@
 
         }
 
-        /**
-         *  Our goal was to work with any protocol.  In order to do that, we needed
-         *  to allow them to call readMessageBegin() and get a TMessage in exactly
-         *  the standard format, without the service name prepended to TMessage.name.
-         */
+        /// <summary>
+        ///  Our goal was to work with any protocol.  In order to do that, we needed
+        ///  to allow them to call readMessageBegin() and get a TMessage in exactly
+        ///  the standard format, without the service name prepended to TMessage.name.
+        /// </summary>
         private class StoredMessageProtocol : TProtocolDecorator
         {
             TMessage MsgBegin;
 
             public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin)
-                :base(protocol)
+                : base(protocol)
             {
                 this.MsgBegin = messageBegin;
             }
diff --git a/lib/csharp/src/Protocol/TMultiplexedProtocol.cs b/lib/csharp/src/Protocol/TMultiplexedProtocol.cs
index 1e2af83..1bd420f 100644
--- a/lib/csharp/src/Protocol/TMultiplexedProtocol.cs
+++ b/lib/csharp/src/Protocol/TMultiplexedProtocol.cs
@@ -29,63 +29,62 @@
 namespace Thrift.Protocol
 {
 
-    /**
-     * TMultiplexedProtocol is a protocol-independent concrete decorator that allows a Thrift
-     * client to communicate with a multiplexing Thrift server, by prepending the service name
-     * to the function name during function calls.
-     *
-     * NOTE: THIS IS NOT TO BE USED BY SERVERS.
-     * On the server, use TMultiplexedProcessor to handle requests from a multiplexing client.
-     *
-     * This example uses a single socket transport to invoke two services:
-     *
-     *     TSocket transport = new TSocket("localhost", 9090);
-     *     transport.open();
-     *
-     *     TBinaryProtocol protocol = new TBinaryProtocol(transport);
-     *
-     *     TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "Calculator");
-     *     Calculator.Client service = new Calculator.Client(mp);
-     *
-     *     TMultiplexedProtocol mp2 = new TMultiplexedProtocol(protocol, "WeatherReport");
-     *     WeatherReport.Client service2 = new WeatherReport.Client(mp2);
-     *
-     *     System.out.println(service.add(2,2));
-     *     System.out.println(service2.getTemperature());
-     *
-     */
+    /// <summary>
+    /// TMultiplexedProtocol is a protocol-independent concrete decorator that allows a Thrift
+    /// client to communicate with a multiplexing Thrift server, by prepending the service name
+    /// to the function name during function calls.
+    /// <para/>
+    /// NOTE: THIS IS NOT TO BE USED BY SERVERS.
+    /// On the server, use TMultiplexedProcessor to handle requests from a multiplexing client.
+    /// <para/>
+    /// This example uses a single socket transport to invoke two services:
+    /// <code>
+    ///     TSocket transport = new TSocket("localhost", 9090);
+    ///     transport.open();
+    ///
+    ///     TBinaryProtocol protocol = new TBinaryProtocol(transport);
+    ///
+    ///     TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "Calculator");
+    ///     Calculator.Client service = new Calculator.Client(mp);
+    ///
+    ///     TMultiplexedProtocol mp2 = new TMultiplexedProtocol(protocol, "WeatherReport");
+    ///     WeatherReport.Client service2 = new WeatherReport.Client(mp2);
+    ///
+    ///     System.out.println(service.add(2,2));
+    ///     System.out.println(service2.getTemperature());
+    /// </code>
+    /// </summary>
     public class TMultiplexedProtocol : TProtocolDecorator
     {
 
-        /** Used to delimit the service name from the function name */
-        public static String SEPARATOR = ":";
+        /// <summary>
+        /// Used to delimit the service name from the function name.
+        /// </summary>
+        public static string SEPARATOR = ":";
 
-        private String ServiceName;
+        private string ServiceName;
 
-        /**
-         * Wrap the specified protocol, allowing it to be used to communicate with a
-         * multiplexing server.  The <code>serviceName</code> is required as it is
-         * prepended to the message header so that the multiplexing server can broker
-         * the function call to the proper service.
-         *
-         * Args:
-         *  protocol        Your communication protocol of choice, e.g. TBinaryProtocol
-         *  serviceName     The service name of the service communicating via this protocol.
-         */
-        public TMultiplexedProtocol(TProtocol protocol, String serviceName)
+        /// <summary>
+        /// Wrap the specified protocol, allowing it to be used to communicate with a
+        /// multiplexing server.  The <paramref name="serviceName"/> is required as it is
+        /// prepended to the message header so that the multiplexing server can broker
+        /// the function call to the proper service.
+        /// </summary>
+        /// <param name="protocol">Your communication protocol of choice, e.g. <see cref="TBinaryProtocol"/>.</param>
+        /// <param name="serviceName">The service name of the service communicating via this protocol.</param>
+        public TMultiplexedProtocol(TProtocol protocol, string serviceName)
             : base(protocol)
         {
             ServiceName = serviceName;
         }
 
-        /**
-         * Prepends the service name to the function name, separated by TMultiplexedProtocol.SEPARATOR.
-         * Args:
-         *   tMessage     The original message.
-         */
+        /// <summary>
+        /// Prepends the service name to the function name, separated by TMultiplexedProtocol.SEPARATOR.
+        /// </summary>
+        /// <param name="tMessage">The original message.</param>
         public override void WriteMessageBegin(TMessage tMessage)
         {
-            switch(tMessage.Type)
+            switch (tMessage.Type)
             {
                 case TMessageType.Call:
                 case TMessageType.Oneway:
@@ -101,5 +100,4 @@
             }
         }
     }
-
 }
diff --git a/lib/csharp/src/Protocol/TProtocol.cs b/lib/csharp/src/Protocol/TProtocol.cs
index bf481ab..dd7a6e0 100644
--- a/lib/csharp/src/Protocol/TProtocol.cs
+++ b/lib/csharp/src/Protocol/TProtocol.cs
@@ -108,7 +108,8 @@
         public abstract void WriteI32(int i32);
         public abstract void WriteI64(long i64);
         public abstract void WriteDouble(double d);
-        public virtual void WriteString(string s) {
+        public virtual void WriteString(string s)
+        {
             WriteBinary(Encoding.UTF8.GetBytes(s));
         }
         public abstract void WriteBinary(byte[] b);
@@ -131,7 +132,8 @@
         public abstract int ReadI32();
         public abstract long ReadI64();
         public abstract double ReadDouble();
-        public virtual string ReadString() {
+        public virtual string ReadString()
+        {
             var buf = ReadBinary();
             return Encoding.UTF8.GetString(buf, 0, buf.Length);
         }
diff --git a/lib/csharp/src/Protocol/TProtocolDecorator.cs b/lib/csharp/src/Protocol/TProtocolDecorator.cs
index 7bc34ef..8600002 100644
--- a/lib/csharp/src/Protocol/TProtocolDecorator.cs
+++ b/lib/csharp/src/Protocol/TProtocolDecorator.cs
@@ -28,26 +28,25 @@
 
 namespace Thrift.Protocol
 {
-
-    /**
-     * TProtocolDecorator forwards all requests to an enclosed TProtocol instance,
-     * providing a way to author concise concrete decorator subclasses.  While it has
-     * no abstract methods, it is marked abstract as a reminder that by itself,
-     * it does not modify the behaviour of the enclosed TProtocol.
-     *
-     * See p.175 of Design Patterns (by Gamma et al.)
-     * See TMultiplexedProtocol
-     */
+    /// <summary>
+    /// <see cref="TProtocolDecorator"/> forwards all requests to an enclosed <see cref="TProtocol"/> instance,
+    /// providing a way to author concise concrete decorator subclasses. While it has
+    /// no abstract methods, it is marked abstract as a reminder that by itself,
+    /// it does not modify the behaviour of the enclosed <see cref="TProtocol"/>.
+    /// <para/>
+    /// See p.175 of Design Patterns (by Gamma et al.)
+    /// </summary>
+    /// <seealso cref="TMultiplexedProtocol"/>
     public abstract class TProtocolDecorator : TProtocol
     {
         private TProtocol WrappedProtocol;
 
-        /**
-         * Encloses the specified protocol.
-         * @param protocol All operations will be forward to this protocol.  Must be non-null.
-         */
+        /// <summary>
+        /// Encloses the specified protocol.
+        /// </summary>
+        /// <param name="protocol">All operations will be forward to this protocol.  Must be non-null.</param>
         public TProtocolDecorator(TProtocol protocol)
-            : base( protocol.Transport)
+            : base(protocol.Transport)
         {
 
             WrappedProtocol = protocol;
@@ -104,7 +103,7 @@
         }
 
         public override void WriteListEnd()
-{
+        {
             WrappedProtocol.WriteListEnd();
         }
 
@@ -148,7 +147,7 @@
             WrappedProtocol.WriteDouble(v);
         }
 
-        public override void WriteString(String s)
+        public override void WriteString(string s)
         {
             WrappedProtocol.WriteString(s);
         }
@@ -248,7 +247,7 @@
             return WrappedProtocol.ReadDouble();
         }
 
-        public override String ReadString()
+        public override string ReadString()
         {
             return WrappedProtocol.ReadString();
         }
diff --git a/lib/csharp/src/Protocol/TProtocolException.cs b/lib/csharp/src/Protocol/TProtocolException.cs
index 76c749d..a89c3fc 100644
--- a/lib/csharp/src/Protocol/TProtocolException.cs
+++ b/lib/csharp/src/Protocol/TProtocolException.cs
@@ -48,13 +48,13 @@
             type_ = type;
         }
 
-        public TProtocolException(int type, String message)
+        public TProtocolException(int type, string message)
             : base(message)
         {
             type_ = type;
         }
 
-        public TProtocolException(String message)
+        public TProtocolException(string message)
             : base(message)
         {
         }
diff --git a/lib/csharp/src/Protocol/TProtocolUtil.cs b/lib/csharp/src/Protocol/TProtocolUtil.cs
index 0606c71..d995c6c 100644
--- a/lib/csharp/src/Protocol/TProtocolUtil.cs
+++ b/lib/csharp/src/Protocol/TProtocolUtil.cs
@@ -98,7 +98,6 @@
                     default:
                         throw new TProtocolException(TProtocolException.INVALID_DATA, "Unknown data type " + type.ToString("d"));
                 }
-
             }
             finally
             {
