You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/01/30 21:03:42 UTC

[avro] branch branch-1.11 updated (adfd147 -> 4cd90d0)

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a change to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git.


    from adfd147  Bump grpc.version from 1.43.2 to 1.44.0 in /lang/java (#1482)
     new e6eaf20  AVRO-3323 Updated documentation and removed suppression of CS1591 (#1474)
     new 4cd90d0  AVRO-3329 Added omitted braces to CodeGen class (#1480)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lang/csharp/src/apache/main/AvroDecimal.cs     | 612 ++++++++++++++++++++-----
 lang/csharp/src/apache/main/CodeGen/CodeGen.cs | 170 ++++++-
 2 files changed, 651 insertions(+), 131 deletions(-)

[avro] 01/02: AVRO-3323 Updated documentation and removed suppression of CS1591 (#1474)

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git

commit e6eaf20053f01d0c41945a49d4ad1f465d185e17
Author: Kyle Schoonover <ky...@minmaxcorp.com>
AuthorDate: Sun Jan 30 12:37:18 2022 -0800

    AVRO-3323 Updated documentation and removed suppression of CS1591 (#1474)
    
    Co-authored-by: Kyle T. Schoonover <Ky...@nordstrom.com>
    Co-authored-by: Martin Grigorov <ma...@users.noreply.github.com>
    (cherry picked from commit 0766e423428b4caf36d5ef3ee1c10bcae21b6269)
---
 lang/csharp/src/apache/main/AvroDecimal.cs | 612 ++++++++++++++++++++++++-----
 1 file changed, 506 insertions(+), 106 deletions(-)

diff --git a/lang/csharp/src/apache/main/AvroDecimal.cs b/lang/csharp/src/apache/main/AvroDecimal.cs
index b7c4d47..98de9b1 100644
--- a/lang/csharp/src/apache/main/AvroDecimal.cs
+++ b/lang/csharp/src/apache/main/AvroDecimal.cs
@@ -25,11 +25,10 @@ namespace Avro
     /// <summary>
     /// Represents a big decimal.
     /// </summary>
-#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
     public struct AvroDecimal : IConvertible, IFormattable, IComparable, IComparable<AvroDecimal>, IEquatable<AvroDecimal>
     {
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given double.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given double.
         /// </summary>
         /// <param name="value">The double value.</param>
         public AvroDecimal(double value)
@@ -38,7 +37,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given float.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given float.
         /// </summary>
         /// <param name="value">The float value.</param>
         public AvroDecimal(float value)
@@ -47,7 +46,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given decimal.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given decimal.
         /// </summary>
         /// <param name="value">The decimal value.</param>
         public AvroDecimal(decimal value)
@@ -70,7 +69,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given int.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given int.
         /// </summary>
         /// <param name="value">The int value.</param>
         public AvroDecimal(int value)
@@ -79,7 +78,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given long.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given long.
         /// </summary>
         /// <param name="value">The long value.</param>
         public AvroDecimal(long value)
@@ -88,7 +87,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given unsigned int.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given unsigned int.
         /// </summary>
         /// <param name="value">The unsigned int value.</param>
         public AvroDecimal(uint value)
@@ -97,7 +96,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given unsigned long.
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given unsigned long.
         /// </summary>
         /// <param name="value">The unsigned long value.</param>
         public AvroDecimal(ulong value)
@@ -106,7 +105,7 @@ namespace Avro
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="AvroDecimal"/> class from a given <see cref="BigInteger"/>
+        /// Initializes a new instance of the <see cref="AvroDecimal" /> struct from a given <see cref="BigInteger" />
         /// and a scale.
         /// </summary>
         /// <param name="unscaledValue">The double value.</param>
@@ -118,27 +117,38 @@ namespace Avro
         }
 
         /// <summary>
-        /// Gets the unscaled integer value represented by the current <see cref="AvroDecimal"/>.
+        /// Gets the unscaled integer value represented by the current <see cref="AvroDecimal" />.
         /// </summary>
+        /// <value>
+        /// The unscaled value.
+        /// </value>
         public BigInteger UnscaledValue { get; }
 
         /// <summary>
-        /// Gets the scale of the current <see cref="AvroDecimal"/>.
+        /// Gets the scale of the current <see cref="AvroDecimal" />.
         /// </summary>
+        /// <value>
+        /// The scale.
+        /// </value>
         public int Scale { get; }
 
         /// <summary>
-        /// Gets the sign of the current <see cref="AvroDecimal"/>.
+        /// Gets the sign of the current <see cref="AvroDecimal" />.
         /// </summary>
+        /// <value>
+        /// The sign.
+        /// </value>
         internal int Sign
         {
             get { return UnscaledValue.Sign; }
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a string.
+        /// Converts the current <see cref="AvroDecimal" /> to a string.
         /// </summary>
-        /// <returns>A string representation of the numeric value.</returns>
+        /// <returns>
+        /// A string representation of the numeric value.
+        /// </returns>
         public override string ToString()
         {
             var number = UnscaledValue.ToString($"D{Scale + 1}", CultureInfo.CurrentCulture);
@@ -151,271 +161,523 @@ namespace Avro
             return number;
         }
 
+        /// <summary>
+        /// Implements the operator ==.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator ==(AvroDecimal left, AvroDecimal right)
         {
             return left.Equals(right);
         }
 
+        /// <summary>
+        /// Implements the operator !=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator !=(AvroDecimal left, AvroDecimal right)
         {
             return !left.Equals(right);
         }
 
+        /// <summary>
+        /// Implements the operator &gt;.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator >(AvroDecimal left, AvroDecimal right)
         {
             return left.CompareTo(right) > 0;
         }
 
+        /// <summary>
+        /// Implements the operator &gt;=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator >=(AvroDecimal left, AvroDecimal right)
         {
             return left.CompareTo(right) >= 0;
         }
 
+        /// <summary>
+        /// Implements the operator &lt;.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator <(AvroDecimal left, AvroDecimal right)
         {
             return left.CompareTo(right) < 0;
         }
 
+        /// <summary>
+        /// Implements the operator &lt;=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator <=(AvroDecimal left, AvroDecimal right)
         {
             return left.CompareTo(right) <= 0;
         }
 
+        /// <summary>
+        /// Implements the operator ==.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator ==(AvroDecimal left, decimal right)
         {
             return left.Equals(right);
         }
 
+        /// <summary>
+        /// Implements the operator !=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator !=(AvroDecimal left, decimal right)
         {
             return !left.Equals(right);
         }
 
+        /// <summary>
+        /// Implements the operator &gt;.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator >(AvroDecimal left, decimal right)
         {
             return left.CompareTo(right) > 0;
         }
 
+        /// <summary>
+        /// Implements the operator &gt;=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator >=(AvroDecimal left, decimal right)
         {
             return left.CompareTo(right) >= 0;
         }
 
+        /// <summary>
+        /// Implements the operator &lt;.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator <(AvroDecimal left, decimal right)
         {
             return left.CompareTo(right) < 0;
         }
 
+        /// <summary>
+        /// Implements the operator &lt;=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator <=(AvroDecimal left, decimal right)
         {
             return left.CompareTo(right) <= 0;
         }
 
+        /// <summary>
+        /// Implements the operator ==.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator ==(decimal left, AvroDecimal right)
         {
             return left.Equals(right);
         }
 
+        /// <summary>
+        /// Implements the operator !=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator !=(decimal left, AvroDecimal right)
         {
             return !left.Equals(right);
         }
 
+        /// <summary>
+        /// Implements the operator &gt;.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator >(decimal left, AvroDecimal right)
         {
             return left.CompareTo(right) > 0;
         }
 
+        /// <summary>
+        /// Implements the operator &gt;=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator >=(decimal left, AvroDecimal right)
         {
             return left.CompareTo(right) >= 0;
         }
 
+        /// <summary>
+        /// Implements the operator &lt;.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator <(decimal left, AvroDecimal right)
         {
             return left.CompareTo(right) < 0;
         }
 
+        /// <summary>
+        /// Implements the operator &lt;=.
+        /// </summary>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns>
+        /// The result of the operator.
+        /// </returns>
         public static bool operator <=(decimal left, AvroDecimal right)
         {
             return left.CompareTo(right) <= 0;
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="byte" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="byte" />.
+        /// </returns>
         public static explicit operator byte(AvroDecimal value)
         {
             return ToByte(value);
         }
 
         /// <summary>
-        /// Creates a byte from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="byte" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A byte.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="byte" />.
+        /// </returns>
         public static byte ToByte(AvroDecimal value)
         {
             return value.ToType<byte>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="sbyte" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="sbyte" />.
+        /// </returns>
         public static explicit operator sbyte(AvroDecimal value)
         {
             return ToSByte(value);
         }
 
         /// <summary>
-        /// Creates a signed byte from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="sbyte" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A signed byte.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="sbyte" />.
+        /// </returns>
         public static sbyte ToSByte(AvroDecimal value)
         {
             return value.ToType<sbyte>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="short" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="short" />.
+        /// </returns>
         public static explicit operator short(AvroDecimal value)
         {
             return ToInt16(value);
         }
 
         /// <summary>
-        /// Creates a short from a given <see cref="AvroDecimal"/>.
+        /// Creates a short from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A short.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="short" />.
+        /// </returns>
         public static short ToInt16(AvroDecimal value)
         {
             return value.ToType<short>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="int" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="int" />.
+        /// </returns>
         public static explicit operator int(AvroDecimal value)
         {
             return ToInt32(value);
         }
 
         /// <summary>
-        /// Creates an int from a given <see cref="AvroDecimal"/>.
+        /// Creates an int from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>An int.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="int" />.
+        /// </returns>
         public static int ToInt32(AvroDecimal value)
         {
             return value.ToType<int>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="long" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="long" />.
+        /// </returns>
         public static explicit operator long(AvroDecimal value)
         {
             return ToInt64(value);
         }
 
         /// <summary>
-        /// Creates a long from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="long" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A long.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="long" />.
+        /// </returns>
         public static long ToInt64(AvroDecimal value)
         {
             return value.ToType<long>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="ushort" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="ushort" />.
+        /// </returns>
         public static explicit operator ushort(AvroDecimal value)
         {
             return ToUInt16(value);
         }
 
         /// <summary>
-        /// Creates an unsigned short from a given <see cref="AvroDecimal"/>.
+        /// Creates an <see cref="ushort" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>An unsigned short.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="ushort" />.
+        /// </returns>
         public static ushort ToUInt16(AvroDecimal value)
         {
             return value.ToType<ushort>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal"/> to <see cref="uint"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
+        /// <returns>
+        /// An <see cref="uint" />.
+        /// </returns>
         public static explicit operator uint(AvroDecimal value)
         {
             return ToUInt32(value);
         }
 
         /// <summary>
-        /// Creates an unsigned int from a given <see cref="AvroDecimal"/>.
+        /// Creates an <see cref="uint" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>An unsigned int.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="uint" />.
+        /// </returns>
         public static uint ToUInt32(AvroDecimal value)
         {
             return value.ToType<uint>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="ulong" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="ulong" />.
+        /// </returns>
         public static explicit operator ulong(AvroDecimal value)
         {
             return ToUInt64(value);
         }
 
         /// <summary>
-        /// Creates an unsigned long from a given <see cref="AvroDecimal"/>.
+        /// Creates an <see cref="ulong" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>An unsigned long.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// An <see cref="ulong" />.
+        /// </returns>
         public static ulong ToUInt64(AvroDecimal value)
         {
             return value.ToType<ulong>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="float" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="float" />.
+        /// </returns>
         public static explicit operator float(AvroDecimal value)
         {
             return ToSingle(value);
         }
 
         /// <summary>
-        /// Creates a double from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="float" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A double.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="float" />.
+        /// </returns>
         public static float ToSingle(AvroDecimal value)
         {
             return value.ToType<float>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="double" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="double" />.
+        /// </returns>
         public static explicit operator double(AvroDecimal value)
         {
             return ToDouble(value);
         }
 
         /// <summary>
-        /// Creates a double from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="double" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A double.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="double" />.
+        /// </returns>
         public static double ToDouble(AvroDecimal value)
         {
             return value.ToType<double>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="decimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="decimal" />.
+        /// </returns>
         public static explicit operator decimal(AvroDecimal value)
         {
             return ToDecimal(value);
         }
 
         /// <summary>
-        /// Creates a decimal from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="decimal" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A decimal.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="decimal" />.
+        /// </returns>
         public static decimal ToDecimal(AvroDecimal value)
         {
             return value.ToType<decimal>();
         }
 
+        /// <summary>
+        /// Performs an explicit conversion from <see cref="AvroDecimal" /> to <see cref="BigInteger" />.
+        /// </summary>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="BigInteger" />.
+        /// </returns>
         public static explicit operator BigInteger(AvroDecimal value)
         {
             return ToBigInteger(value);
         }
 
         /// <summary>
-        /// Creates a <see cref="BigInteger"/> from a given <see cref="AvroDecimal"/>.
+        /// Creates a <see cref="BigInteger" /> from a given <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="value">The <see cref="AvroDecimal"/>.</param>
-        /// <returns>A <see cref="BigInteger"/>.</returns>
+        /// <param name="value">The <see cref="AvroDecimal" />.</param>
+        /// <returns>
+        /// A <see cref="BigInteger" />.
+        /// </returns>
         public static BigInteger ToBigInteger(AvroDecimal value)
         {
             var scaleDivisor = BigInteger.Pow(new BigInteger(10), value.Scale);
@@ -423,71 +685,157 @@ namespace Avro
             return scaledValue;
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="byte" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The byte <see cref="byte" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(byte value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="sbyte" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="sbyte" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(sbyte value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="short" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="short" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(short value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="int" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="int" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(int value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="long" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="long" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(long value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="ushort" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="ushort" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(ushort value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="uint" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="uint" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(uint value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="ulong" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="ulong" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(ulong value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="float" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="float" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(float value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="double" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="double" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(double value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="decimal" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="decimal" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(decimal value)
         {
             return new AvroDecimal(value);
         }
 
+        /// <summary>
+        /// Performs an implicit conversion from <see cref="BigInteger" /> to <see cref="AvroDecimal" />.
+        /// </summary>
+        /// <param name="value">The <see cref="BigInteger" />.</param>
+        /// <returns>
+        /// An <see cref="AvroDecimal" />.
+        /// </returns>
         public static implicit operator AvroDecimal(BigInteger value)
         {
             return new AvroDecimal(value, 0);
         }
 
         /// <summary>
-        /// Converts the numeric value of the current <see cref="AvroDecimal"/> to a given type.
+        /// Converts the numeric value of the current <see cref="AvroDecimal" /> to a given type.
         /// </summary>
-        /// <typeparam name="T">The type to which the value of the current <see cref="AvroDecimal"/> should be converted.</typeparam>
-        /// <returns>A value of type <typeparamref name="T"/> converted from the current <see cref="AvroDecimal"/>.</returns>
+        /// <typeparam name="T">The type to which the value of the current <see cref="AvroDecimal" /> should be converted.</typeparam>
+        /// <returns>
+        /// A value of type <typeparamref name="T" /> converted from the current <see cref="AvroDecimal" />.
+        /// </returns>
         public T ToType<T>()
             where T : struct
         {
@@ -522,12 +870,13 @@ namespace Avro
         }
 
         /// <summary>
-        /// Returns a value that indicates whether the current <see cref="AvroDecimal"/> and a specified object
+        /// Returns a value that indicates whether the current <see cref="AvroDecimal" /> and a specified object
         /// have the same value.
         /// </summary>
         /// <param name="obj">The object to compare.</param>
-        /// <returns>true if the obj argument is an <see cref="AvroDecimal"/> object, and its value
-        /// is equal to the value of the current <see cref="AvroDecimal"/> instance; otherwise false.
+        /// <returns>
+        /// true if the obj argument is an <see cref="AvroDecimal" /> object, and its value
+        /// is equal to the value of the current <see cref="AvroDecimal" /> instance; otherwise false.
         /// </returns>
         public override bool Equals(object obj)
         {
@@ -535,189 +884,230 @@ namespace Avro
         }
 
         /// <summary>
-        /// Returns the hash code for the current <see cref="AvroDecimal"/>.
+        /// Returns the hash code for the current <see cref="AvroDecimal" />.
         /// </summary>
-        /// <returns>The hash code.</returns>
+        /// <returns>
+        /// The hash code.
+        /// </returns>
         public override int GetHashCode()
         {
             return UnscaledValue.GetHashCode() ^ Scale.GetHashCode();
         }
 
         /// <summary>
-        /// Returns the <see cref="TypeCode"/> for the current <see cref="AvroDecimal"/>.
+        /// Returns the <see cref="TypeCode" /> for the current <see cref="AvroDecimal" />.
         /// </summary>
-        /// <returns><see cref="TypeCode.Object"/>.</returns>
+        /// <returns>
+        /// The enumerated constant that is the <see cref="T:System.TypeCode"></see> of the class or value type that implements this interface.
+        /// </returns>
         TypeCode IConvertible.GetTypeCode()
         {
             return TypeCode.Object;
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a boolean.
+        /// Converts the current <see cref="AvroDecimal" /> to a boolean.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>true or false, which reflects the value of the current <see cref="AvroDecimal"/>.</returns>
+        /// <returns>
+        /// true or false, which reflects the value of the current <see cref="AvroDecimal" />.
+        /// </returns>
         bool IConvertible.ToBoolean(IFormatProvider provider)
         {
             return Convert.ToBoolean(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a byte.
+        /// Converts the current <see cref="AvroDecimal" /> to a byte.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A byte.</returns>
+        /// <returns>
+        /// A <see cref="byte" />.
+        /// </returns>
         byte IConvertible.ToByte(IFormatProvider provider)
         {
             return Convert.ToByte(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a char.
+        /// Converts the current <see cref="AvroDecimal" /> to a char.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>This method always throws an <see cref="InvalidCastException"/>.</returns>
+        /// <returns>
+        /// This method always throws an <see cref="InvalidCastException" />.
+        /// </returns>
+        /// <exception cref="System.InvalidCastException">Cannot cast BigDecimal to Char.</exception>
         char IConvertible.ToChar(IFormatProvider provider)
         {
             throw new InvalidCastException("Cannot cast BigDecimal to Char");
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a <see cref="DateTime"/>.
+        /// Converts the current <see cref="AvroDecimal" /> to a <see cref="DateTime" />.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>This method always throws an <see cref="InvalidCastException"/>.</returns>
+        /// <returns>
+        /// This method always throws an <see cref="InvalidCastException" />.
+        /// </returns>
+        /// <exception cref="System.InvalidCastException">Cannot cast BigDecimal to DateTime.</exception>
         DateTime IConvertible.ToDateTime(IFormatProvider provider)
         {
             throw new InvalidCastException("Cannot cast BigDecimal to DateTime");
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a decimal.
+        /// Converts the current <see cref="AvroDecimal" /> to a decimal.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A decimal.</returns>
+        /// <returns>
+        /// A <see cref="decimal" />.
+        /// </returns>
         decimal IConvertible.ToDecimal(IFormatProvider provider)
         {
             return Convert.ToDecimal(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a double.
+        /// Converts the current <see cref="AvroDecimal" /> to a double.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A double.</returns>
+        /// <returns>
+        /// A <see cref="double" />.
+        /// </returns>
         double IConvertible.ToDouble(IFormatProvider provider)
         {
             return Convert.ToDouble(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a short.
+        /// Converts the current <see cref="AvroDecimal" /> to a short.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A short.</returns>
+        /// <returns>
+        /// A <see cref="short" />.
+        /// </returns>
         short IConvertible.ToInt16(IFormatProvider provider)
         {
             return Convert.ToInt16(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to an int.
+        /// Converts the current <see cref="AvroDecimal" /> to an int.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>An int.</returns>
+        /// <returns>
+        /// An <see cref="int" />.
+        /// </returns>
         int IConvertible.ToInt32(IFormatProvider provider)
         {
             return Convert.ToInt32(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a long.
+        /// Converts the current <see cref="AvroDecimal" /> to a long.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A long.</returns>
+        /// <returns>
+        /// A <see cref="long" />.
+        /// </returns>
         long IConvertible.ToInt64(IFormatProvider provider)
         {
             return Convert.ToInt64(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a signed byte.
+        /// Converts the current <see cref="AvroDecimal" /> to a signed byte.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A signed byte.</returns>
+        /// <returns>
+        /// A <see cref="sbyte" />.
+        /// </returns>
         sbyte IConvertible.ToSByte(IFormatProvider provider)
         {
             return Convert.ToSByte(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a float.
+        /// Converts the current <see cref="AvroDecimal" /> to a float.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A float.</returns>
+        /// <returns>
+        /// A <see cref="float" />.
+        /// </returns>
         float IConvertible.ToSingle(IFormatProvider provider)
         {
             return Convert.ToSingle(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a string.
+        /// Converts the current <see cref="AvroDecimal" /> to a string.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>A string.</returns>
+        /// <returns>
+        /// A <see cref="string" />.
+        /// </returns>
         string IConvertible.ToString(IFormatProvider provider)
         {
             return Convert.ToString(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to an unsigned short.
+        /// Converts the current <see cref="AvroDecimal" /> to an unsigned short.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>An unsigned short.</returns>
+        /// <returns>
+        /// An <see cref="ushort" />.
+        /// </returns>
         ushort IConvertible.ToUInt16(IFormatProvider provider)
         {
             return Convert.ToUInt16(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to an unsigned int.
+        /// Converts the current <see cref="AvroDecimal" /> to an unsigned int.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>An unsigned int.</returns>
+        /// <returns>
+        /// An <see cref="uint" />.
+        /// </returns>
         uint IConvertible.ToUInt32(IFormatProvider provider)
         {
             return Convert.ToUInt32(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to an unsigned long.
+        /// Converts the current <see cref="AvroDecimal" /> to an unsigned long.
         /// </summary>
         /// <param name="provider">The format provider.</param>
-        /// <returns>An unsigned long.</returns>
+        /// <returns>
+        /// An <see cref="ulong" />.
+        /// </returns>
         ulong IConvertible.ToUInt64(IFormatProvider provider)
         {
             return Convert.ToUInt64(this, provider);
         }
 
         /// <summary>
-        /// Converts the current <see cref="AvroDecimal"/> to a string.
+        /// Converts the current <see cref="AvroDecimal" /> to a string.
         /// </summary>
-        /// <param name="format"></param>
+        /// <param name="format">The format.</param>
         /// <param name="formatProvider">The format provider.</param>
-        /// <returns>A string representation of the numeric value.</returns>
+        /// <returns>
+        /// A string representation of the numeric value.
+        /// </returns>
         public string ToString(string format, IFormatProvider formatProvider)
         {
             return ToString();
         }
 
         /// <summary>
-        /// Compares the value of the current <see cref="AvroDecimal"/> to the value of another object.
+        /// Compares the value of the current <see cref="AvroDecimal" /> to the value of another object.
         /// </summary>
         /// <param name="obj">The object to compare.</param>
-        /// <returns>A value that indicates the relative order of the objects being compared.</returns>
+        /// <returns>
+        /// A value that indicates the relative order of the objects being compared.
+        /// </returns>
+        /// <exception cref="System.ArgumentException">Compare to object must be a BigDecimal - obj.</exception>
         public int CompareTo(object obj)
         {
             if (obj == null)
@@ -734,12 +1124,14 @@ namespace Avro
         }
 
         /// <summary>
-        /// Compares the value of the current <see cref="AvroDecimal"/> to the value of another
-        /// <see cref="AvroDecimal"/>.
+        /// Compares the value of the current <see cref="AvroDecimal" /> to the value of another
+        /// <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="other">The <see cref="AvroDecimal"/> to compare.</param>
-        /// <returns>A value that indicates the relative order of the <see cref="AvroDecimal"/>
-        /// instances being compared.</returns>
+        /// <param name="other">The <see cref="AvroDecimal" /> to compare.</param>
+        /// <returns>
+        /// A value that indicates the relative order of the <see cref="AvroDecimal" />
+        /// instances being compared.
+        /// </returns>
         public int CompareTo(AvroDecimal other)
         {
             var unscaledValueCompare = UnscaledValue.CompareTo(other.UnscaledValue);
@@ -764,17 +1156,26 @@ namespace Avro
         }
 
         /// <summary>
-        /// Returns a value that indicates whether the current <see cref="AvroDecimal"/> has the same
-        /// value as another <see cref="AvroDecimal"/>.
+        /// Returns a value that indicates whether the current <see cref="AvroDecimal" /> has the same
+        /// value as another <see cref="AvroDecimal" />.
         /// </summary>
-        /// <param name="other">The <see cref="AvroDecimal"/> to compare.</param>
-        /// <returns>true if the current <see cref="AvroDecimal"/> has the same value as <paramref name="other"/>;
-        /// otherwise false.</returns>
+        /// <param name="other">The <see cref="AvroDecimal" /> to compare.</param>
+        /// <returns>
+        /// true if the current <see cref="AvroDecimal" /> has the same value as <paramref name="other" />;
+        /// otherwise false.
+        /// </returns>
         public bool Equals(AvroDecimal other)
         {
             return Scale == other.Scale && UnscaledValue == other.UnscaledValue;
         }
 
+        /// <summary>
+        /// Gets the bytes from decimal.
+        /// </summary>
+        /// <param name="d">The <see cref="decimal" />.</param>
+        /// <returns>
+        /// A byte array.
+        /// </returns>
         private static byte[] GetBytesFromDecimal(decimal d)
         {
             byte[] bytes = new byte[16];
@@ -805,5 +1206,4 @@ namespace Avro
             return bytes;
         }
     }
-#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
 }

[avro] 02/02: AVRO-3329 Added omitted braces to CodeGen class (#1480)

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 4cd90d08a97d3d9dbc74113efd6df142aa749a3d
Author: Kyle Schoonover <ky...@minmaxcorp.com>
AuthorDate: Sun Jan 30 13:02:58 2022 -0800

    AVRO-3329 Added omitted braces to CodeGen class (#1480)
    
    * AVRO-3329 Added omitted braces to CodeGen class
    
    * revert names?.Contains null check
    
    Co-authored-by: Kyle T. Schoonover <Ky...@nordstrom.com>
    (cherry picked from commit 5eff9a7f503ab0de550c99b6b46ac628ca9d817d)
---
 lang/csharp/src/apache/main/CodeGen/CodeGen.cs | 170 +++++++++++++++++++++----
 1 file changed, 145 insertions(+), 25 deletions(-)

diff --git a/lang/csharp/src/apache/main/CodeGen/CodeGen.cs b/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
index 6d4b16d..b282570 100644
--- a/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
+++ b/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
@@ -123,7 +123,9 @@ namespace Avro
         protected virtual CodeNamespace addNamespace(string name)
         {
             if (string.IsNullOrEmpty(name))
+            {
                 throw new ArgumentNullException(nameof(name), "name cannot be null.");
+            }
 
             CodeNamespace ns = null;
 
@@ -135,7 +137,9 @@ namespace Avro
                     : new CodeNamespace(CodeGenUtil.Instance.Mangle(name));
 
                 foreach (CodeNamespaceImport nci in CodeGenUtil.Instance.NamespaceImports)
+                {
                     ns.Imports.Add(nci);
+                }
 
                 CompileUnit.Namespaces.Add(ns);
                 NamespaceLookup.Add(name, ns);
@@ -219,7 +223,10 @@ namespace Avro
         {
             var names = new SchemaNames();
             foreach (Schema schema in protocol.Types)
+            {
                 addName(schema, names);
+            }
+
             return names;
         }
 
@@ -246,7 +253,10 @@ namespace Avro
         protected virtual void addName(Schema schema, SchemaNames names)
         {
             NamedSchema ns = schema as NamedSchema;
-            if (null != ns) if (names.Contains(ns.SchemaName)) return;
+            if (ns != null && names.Contains(ns.SchemaName))
+            {
+                return;
+            }
 
             switch (schema.Tag)
             {
@@ -271,7 +281,10 @@ namespace Avro
                     var rs = schema as RecordSchema;
                     names.Add(rs);
                     foreach (Field field in rs.Fields)
+                    {
                         addName(field.Schema, names);
+                    }
+
                     break;
 
                 case Schema.Type.Array:
@@ -287,7 +300,10 @@ namespace Avro
                 case Schema.Type.Union:
                     var us = schema as UnionSchema;
                     foreach (Schema usc in us.Schemas)
+                    {
                         addName(usc, names);
+                    }
+
                     break;
 
                 default:
@@ -307,7 +323,10 @@ namespace Avro
         protected virtual void processFixed(Schema schema)
         {
             FixedSchema fixedSchema = schema as FixedSchema;
-            if (null == fixedSchema) throw new CodeGenException("Unable to cast schema into a fixed");
+            if (fixedSchema == null)
+            {
+                throw new CodeGenException("Unable to cast schema into a fixed");
+            }
 
             CodeTypeDeclaration ctd = new CodeTypeDeclaration();
             ctd.Name = CodeGenUtil.Instance.Mangle(fixedSchema.Name);
@@ -348,7 +367,10 @@ namespace Avro
 
             string nspace = fixedSchema.Namespace;
             if (string.IsNullOrEmpty(nspace))
+            {
                 throw new CodeGenException("Namespace required for enum schema " + fixedSchema.Name);
+            }
+
             CodeNamespace codens = addNamespace(nspace);
             codens.Types.Add(ctd);
         }
@@ -367,7 +389,10 @@ namespace Avro
         protected virtual void processEnum(Schema schema)
         {
             EnumSchema enumschema = schema as EnumSchema;
-            if (null == enumschema) throw new CodeGenException("Unable to cast schema into an enum");
+            if (enumschema == null)
+            {
+                throw new CodeGenException("Unable to cast schema into an enum");
+            }
 
             CodeTypeDeclaration ctd = new CodeTypeDeclaration(CodeGenUtil.Instance.Mangle(enumschema.Name));
             ctd.IsEnum = true;
@@ -381,14 +406,20 @@ namespace Avro
             foreach (string symbol in enumschema.Symbols)
             {
                 if (CodeGenUtil.Instance.ReservedKeywords.Contains(symbol))
+                {
                     throw new CodeGenException("Enum symbol " + symbol + " is a C# reserved keyword");
+                }
+
                 CodeMemberField field = new CodeMemberField(typeof(int), symbol);
                 ctd.Members.Add(field);
             }
 
             string nspace = enumschema.Namespace;
             if (string.IsNullOrEmpty(nspace))
+            {
                 throw new CodeGenException("Namespace required for enum schema " + enumschema.Name);
+            }
+
             CodeNamespace codens = addNamespace(nspace);
 
             codens.Types.Add(ctd);
@@ -473,7 +504,10 @@ namespace Avro
 
             string nspace = protocol.Namespace;
             if (string.IsNullOrEmpty(nspace))
+            {
                 throw new CodeGenException("Namespace required for enum schema " + nspace);
+            }
+
             CodeNamespace codens = addNamespace(nspace);
 
             codens.Types.Add(ctd);
@@ -537,14 +571,18 @@ namespace Avro
                 var response = message.Response;
 
                 if (generateCallback && message.Oneway.GetValueOrDefault())
+                {
                     continue;
+                }
 
                 var messageMember = new CodeMemberMethod();
                 messageMember.Name = CodeGenUtil.Instance.Mangle(name);
                 messageMember.Attributes = MemberAttributes.Public | MemberAttributes.Abstract;
 
                 if (message.Doc != null && message.Doc.Trim() != string.Empty)
+                {
                     messageMember.Comments.Add(new CodeCommentStatement(message.Doc));
+                }
 
                 if (message.Oneway.GetValueOrDefault() || generateCallback)
                 {
@@ -594,7 +632,9 @@ namespace Avro
             {
                 var interfaceDoc = createDocComment(protocol.Doc);
                 if (interfaceDoc != null)
+                {
                     ctd.Comments.Add(interfaceDoc);
+                }
             }
         }
 
@@ -613,7 +653,10 @@ namespace Avro
         protected virtual CodeTypeDeclaration processRecord(Schema schema)
         {
             RecordSchema recordSchema = schema as RecordSchema;
-            if (null == recordSchema) throw new CodeGenException("Unable to cast schema into a record");
+            if (recordSchema == null)
+            {
+                throw new CodeGenException("Unable to cast schema into a record");
+            }
 
             bool isError = recordSchema.Tag == Schema.Type.Error;
 
@@ -681,8 +724,10 @@ namespace Avro
                 if (!string.IsNullOrEmpty(field.Documentation))
                 {
                     propertyComment = createDocComment(field.Documentation);
-                    if (null != propertyComment)
+                    if (propertyComment != null)
+                    {
                         codeField.Comments.Add(propertyComment);
+                    }
                 }
 
                 // Add field to class
@@ -699,8 +744,10 @@ namespace Avro
                 property.Type = ctrfield;
                 property.GetStatements.Add(new CodeMethodReturnStatement(fieldRef));
                 property.SetStatements.Add(new CodeAssignStatement(fieldRef, new CodePropertySetValueReferenceExpression()));
-                if (null != propertyComment)
+                if (propertyComment != null)
+                {
                     property.Comments.Add(propertyComment);
+                }
 
                 // Add field property to class
                 ctd.Members.Add(property);
@@ -754,7 +801,10 @@ namespace Avro
 
             string nspace = recordSchema.Namespace;
             if (string.IsNullOrEmpty(nspace))
+            {
                 throw new CodeGenException("Namespace required for record schema " + recordSchema.Name);
+            }
+
             CodeNamespace codens = addNamespace(nspace);
 
             codens.Types.Add(ctd);
@@ -794,20 +844,54 @@ namespace Avro
                 case Schema.Type.Null:
                     return typeof(object).ToString();
                 case Schema.Type.Boolean:
-                    if (nullible) return $"System.Nullable<{typeof(bool)}>";
-                    else return typeof(bool).ToString();
+                    if (nullible)
+                    {
+                        return $"System.Nullable<{typeof(bool)}>";
+                    }
+                    else
+                    {
+                        return typeof(bool).ToString();
+                    }
+
                 case Schema.Type.Int:
-                    if (nullible) return $"System.Nullable<{typeof(int)}>";
-                    else return typeof(int).ToString();
+                    if (nullible)
+                    {
+                        return $"System.Nullable<{typeof(int)}>";
+                    }
+                    else
+                    {
+                        return typeof(int).ToString();
+                    }
+
                 case Schema.Type.Long:
-                    if (nullible) return $"System.Nullable<{typeof(long)}>";
-                    else return typeof(long).ToString();
+                    if (nullible)
+                    {
+                        return $"System.Nullable<{typeof(long)}>";
+                    }
+                    else
+                    {
+                        return typeof(long).ToString();
+                    }
+
                 case Schema.Type.Float:
-                    if (nullible) return $"System.Nullable<{typeof(float)}>";
-                    else return typeof(float).ToString();
+                    if (nullible)
+                    {
+                        return $"System.Nullable<{typeof(float)}>";
+                    }
+                    else
+                    {
+                        return typeof(float).ToString();
+                    }
+
                 case Schema.Type.Double:
-                    if (nullible) return $"System.Nullable<{typeof(double)}>";
-                    else return typeof(double).ToString();
+                    if (nullible)
+                    {
+                        return $"System.Nullable<{typeof(double)}>";
+                    }
+                    else
+                    {
+                        return typeof(double).ToString();
+                    }
 
                 case Schema.Type.Bytes:
                     return typeof(byte[]).ToString();
@@ -816,50 +900,74 @@ namespace Avro
 
                 case Schema.Type.Enumeration:
                     var namedSchema = schema as NamedSchema;
-                    if (null == namedSchema)
+                    if (namedSchema == null)
+                    {
                         throw new CodeGenException("Unable to cast schema into a named schema");
+                    }
+
                     if (nullible)
                     {
                         nullibleEnum = true;
                         return "System.Nullable<" + CodeGenUtil.Instance.Mangle(namedSchema.Fullname) + ">";
                     }
-                    else return CodeGenUtil.Instance.Mangle(namedSchema.Fullname);
+                    else
+                    {
+                        return CodeGenUtil.Instance.Mangle(namedSchema.Fullname);
+                    }
 
                 case Schema.Type.Fixed:
                 case Schema.Type.Record:
                 case Schema.Type.Error:
                     namedSchema = schema as NamedSchema;
-                    if (null == namedSchema)
+                    if (namedSchema == null)
+                    {
                         throw new CodeGenException("Unable to cast schema into a named schema");
+                    }
+
                     return CodeGenUtil.Instance.Mangle(namedSchema.Fullname);
 
                 case Schema.Type.Array:
                     var arraySchema = schema as ArraySchema;
-                    if (null == arraySchema)
+                    if (arraySchema == null)
+                    {
                         throw new CodeGenException("Unable to cast schema into an array schema");
+                    }
 
                     return "IList<" + getType(arraySchema.ItemSchema, false, ref nullibleEnum) + ">";
 
                 case Schema.Type.Map:
                     var mapSchema = schema as MapSchema;
-                    if (null == mapSchema)
+                    if (mapSchema == null)
+                    {
                         throw new CodeGenException("Unable to cast schema into a map schema");
+                    }
+
                     return "IDictionary<string," + getType(mapSchema.ValueSchema, false, ref nullibleEnum) + ">";
 
                 case Schema.Type.Union:
                     var unionSchema = schema as UnionSchema;
-                    if (null == unionSchema)
+                    if (unionSchema == null)
+                    {
                         throw new CodeGenException("Unable to cast schema into a union schema");
+                    }
+
                     Schema nullibleType = getNullableType(unionSchema);
-                    if (null == nullibleType)
+                    if (nullibleType == null)
+                    {
                         return CodeGenUtil.Object;
+                    }
                     else
+                    {
                         return getType(nullibleType, true, ref nullibleEnum);
+                    }
 
                 case Schema.Type.Logical:
                     var logicalSchema = schema as LogicalSchema;
-                    if (null == logicalSchema)
+                    if (logicalSchema == null)
+                    {
                         throw new CodeGenException("Unable to cast schema into a logical schema");
+                    }
+
                     var csharpType = logicalSchema.LogicalType.GetCSharpType(nullible);
                     if (csharpType.IsGenericType && csharpType.GetGenericTypeDefinition() == typeof(Nullable<>))
                     {
@@ -890,12 +998,18 @@ namespace Avro
                 foreach (Schema childSchema in schema.Schemas)
                 {
                     if (childSchema.Tag == Schema.Type.Null)
+                    {
                         nullable = true;
+                    }
                     else
+                    {
                         ret = childSchema;
+                    }
                 }
                 if (!nullable)
+                {
                     ret = null;
+                }
             }
             return ret;
         }
@@ -925,7 +1039,11 @@ namespace Avro
             // create property to get static schema field
             var property = new CodeMemberProperty();
             property.Attributes = MemberAttributes.Public;
-            if (overrideFlag) property.Attributes |= MemberAttributes.Override;
+            if (overrideFlag)
+            {
+                property.Attributes |= MemberAttributes.Override;
+            }
+
             property.Name = "Schema";
             property.Type = ctrfield;
 
@@ -994,7 +1112,9 @@ namespace Avro
                 var new_ns = new CodeNamespace(ns.Name);
                 new_ns.Comments.Add(CodeGenUtil.Instance.FileComment);
                 foreach (CodeNamespaceImport nci in CodeGenUtil.Instance.NamespaceImports)
+                {
                     new_ns.Imports.Add(nci);
+                }
 
                 var types = ns.Types;
                 for (int j = 0; j < types.Count; j++)