You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2014/08/20 04:32:10 UTC

[6/9] git commit: adding resharper & ghostdoc settings. refactoring code for consistency.

adding resharper & ghostdoc settings. refactoring code for consistency.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/785acd7d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/785acd7d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/785acd7d

Branch: refs/heads/pcl
Commit: 785acd7d395619f3c0bf0b2cfe5018d383b04a13
Parents: 46f748b
Author: Michael Herndon <mh...@michaelherndon.com>
Authored: Tue Aug 19 10:57:33 2014 -0400
Committer: Michael Herndon <mh...@michaelherndon.com>
Committed: Tue Aug 19 10:57:33 2014 -0400

----------------------------------------------------------------------
 Lucene.vs2013.sln.DotSettings                   |   6 +
 Lucene.vs2013.sln.GhostDoc.user.dic             |   1 +
 resharper.DotSettings                           |   1 +
 src/Lucene.Net.Core/Check.cs                    |  83 +++--
 src/Lucene.Net.Core/Lucene.Net.Core.csproj      |   6 +-
 .../Support/AtomicReferenceArray.cs             |  10 +-
 .../Support/DeepCloneNotSupportedException.cs   |   2 +-
 src/Lucene.Net.Core/Support/EnumUtil.cs         |   4 +
 src/Lucene.Net.Core/Support/HashMap.cs          | 168 +++++-----
 src/Lucene.Net.Core/Support/ICharSequence.cs    |   2 +-
 src/Lucene.Net.Core/Support/ICloneable.cs       |   3 +-
 .../Support/NumberExtensionMethods.cs           |  24 +-
 .../Support/SerializableAttribute.cs            |   2 +-
 .../ShallowCloneNotSupportedException.cs        |   8 +-
 .../Support/StringExtensionMethods.cs           |   3 +-
 .../Support/SupportExtensionMethods.cs          |   5 +-
 .../Util/ArrayInPlaceMergeSorter`.cs            |   1 -
 src/Lucene.Net.Core/Util/ArrayUtil.cs           |  92 +++---
 src/Lucene.Net.Core/Util/BitUtil.cs             |  50 +--
 src/Lucene.Net.Core/Util/Bits.cs                |   2 +
 src/Lucene.Net.Core/Util/BroadWord.cs           | 150 +++++----
 src/Lucene.Net.Core/Util/BytesRef.cs            | 286 +++++++++--------
 src/Lucene.Net.Core/Util/CharsRef.cs            | 304 +++++++++----------
 src/Lucene.Net.Core/Util/CharsRefBuilder.cs     |  29 +-
 src/Lucene.Net.Core/Util/Constants.cs           |  11 +-
 src/Lucene.Net.Core/Util/IBits.cs               |   1 +
 src/Lucene.Net.Core/Util/InPlaceMergeSorter.cs  |   6 +-
 src/Lucene.Net.Core/Util/PclPurgeStrategy.cs    |   2 +-
 .../Util/PurgeableThreadLocal.cs                |   5 +-
 src/Lucene.Net.Core/Util/RamUsageEstimator.cs   | 139 ++++-----
 src/Lucene.Net.Core/Util/SetOnce.cs             |   9 +-
 src/Lucene.Net.Core/Util/Sorter.cs              |  25 +-
 src/Lucene.Net.Core/Util/StringHelper.cs        |   1 -
 src/Lucene.Net.Core/Util/SystemProps.cs         |   2 +-
 src/Lucene.Net.Core/Util/UnicodeUtil.cs         | 152 +++++-----
 src/Lucene.Net.Core/Util/Version.cs             |   6 +-
 src/Lucene.Net.Core/Util/WeakIdentityMap.cs     |  10 +-
 src/Lucene.Net.Core/packages.config             |   2 +-
 test/Lucene.Net.Core.Tests/Util/TestCharsRef.cs |   2 +-
 39 files changed, 820 insertions(+), 795 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/Lucene.vs2013.sln.DotSettings
----------------------------------------------------------------------
diff --git a/Lucene.vs2013.sln.DotSettings b/Lucene.vs2013.sln.DotSettings
new file mode 100644
index 0000000..cd529a2
--- /dev/null
+++ b/Lucene.vs2013.sln.DotSettings
@@ -0,0 +1,6 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+	<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=A8BB631018EFC640A424332B0DF814E6/AbsolutePath/@EntryValue">C:\opt\projects\lucene.net\resharper.DotSettings</s:String>
+	<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=A8BB631018EFC640A424332B0DF814E6/RelativePath/@EntryValue">..\resharper.DotSettings</s:String>
+	<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=A8BB631018EFC640A424332B0DF814E6/@KeyIndexDefined">True</s:Boolean>
+	<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileA8BB631018EFC640A424332B0DF814E6/@KeyIndexDefined">True</s:Boolean>
+	<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=FileA8BB631018EFC640A424332B0DF814E6/RelativePriority/@EntryValue">1</s:Double></wpf:ResourceDictionary>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/Lucene.vs2013.sln.GhostDoc.user.dic
----------------------------------------------------------------------
diff --git a/Lucene.vs2013.sln.GhostDoc.user.dic b/Lucene.vs2013.sln.GhostDoc.user.dic
new file mode 100644
index 0000000..b058ecd
--- /dev/null
+++ b/Lucene.vs2013.sln.GhostDoc.user.dic
@@ -0,0 +1 @@
+Subword

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/resharper.DotSettings
----------------------------------------------------------------------
diff --git a/resharper.DotSettings b/resharper.DotSettings
new file mode 100644
index 0000000..e7d45a2
--- /dev/null
+++ b/resharper.DotSettings
@@ -0,0 +1 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Check.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Check.cs b/src/Lucene.Net.Core/Check.cs
index 96913c8..82a2590 100644
--- a/src/Lucene.Net.Core/Check.cs
+++ b/src/Lucene.Net.Core/Check.cs
@@ -30,76 +30,75 @@ namespace Lucene.Net
         [DebuggerStepThrough]
         public static void Condition(bool condition, string name, string message, params object[] args)
         {
-            if (condition)
-            {
-                var formattedMessage = message;
-                if (args != null && args.Length > 0)
-                    formattedMessage = string.Format(message, args);
-
-                throw new ArgumentException(formattedMessage, name);
-            }
+            if (!condition) 
+                return;
+            
+            var formattedMessage = message;
+            if (args != null && args.Length > 0)
+                formattedMessage = string.Format(message, args);
+
+            throw new ArgumentException(formattedMessage, name);
         }
 
         [DebuggerStepThrough]
         public static void Condition<T>(bool condition, string message, params object[] args) where T : Exception
         {
-            if (condition)
-            {
-                var formattedMessage = message;
-                if (args != null && args.Length > 0)
-                    formattedMessage = string.Format(message, args);
+            if (!condition) 
+                return;
+            
+            var formattedMessage = message;
+            if (args != null && args.Length > 0)
+                formattedMessage = string.Format(message, args);
 
-                var ctorArgs = new object[] { formattedMessage };
-                var exception = (T)Activator.CreateInstance(typeof(T), ctorArgs);
+            var constructorArgs = new object[] { formattedMessage };
+            var exception = (T)Activator.CreateInstance(typeof(T), constructorArgs);
 
-                throw exception;
-            }
+            throw exception;
         }
 
         [DebuggerStepThrough]
         public static void InRangeOfLength(int start, int count, int length)
         {
-            if (start < 0 || start > length || count > length || start > count)
-            {
-                var message = string.Format("The argument, start, must not be less than 0 or " +
-                    " greater than end or Length. The argument, count, must be equal to or less than Length. " +
-                    " Start was {0}. Count was {1}. Length was {2}", start, count, length);
-
-                throw new IndexOutOfRangeException(message);
-            }
+            if (start >= 0 && start <= length && count <= length && start <= count) 
+                return;
+            
+            var message = string.Format("The argument, start, must not be less than 0 or " +
+                                        " greater than end or Length. The argument, count, must be equal to or less than Length. " +
+                                        " Start was {0}. Count was {1}. Length was {2}", start, count, length);
+
+            throw new IndexOutOfRangeException(message);
         }
 
         [DebuggerStepThrough]
         public static void InRangeOfLength(string argument, int value, int length)
         {
-            if (value < 0 || value > length)
-            {
-                var message = string.Format("{0} must not be less than 0 or " +
-                    "greater than or equal to the Length, {1}. {0} was {2}", argument, length, value);
+            if (value >= 0 && value <= length) 
+                return;
+            
+            var message = string.Format("{0} must not be less than 0 or " +
+                                        "greater than or equal to the Length, {1}. {0} was {2}", argument, length, value);
 
-                throw new IndexOutOfRangeException(message);
-            }
+            throw new IndexOutOfRangeException(message);
         }
 
         [DebuggerStepThrough]
         public static T NotNull<T>(string argument, T value, bool reference = false)
         {
-            if (value == null)
-            {
-                if (reference)
-                    throw new NullReferenceException(argument + " cannot be null.");
-                else
-                    throw new ArgumentNullException(argument);
 
-            }
-
-            return value;
+            // ReSharper disable once CompareNonConstrainedGenericWithNull
+            if (typeof (T).GetTypeInfo().IsValueType || value != null) 
+                return value;
+            
+            if (reference)
+                throw new NullReferenceException(argument + " cannot be null.");
+                
+            throw new ArgumentNullException(argument);
         }
 
         [DebuggerStepThrough]
         public static string NotEmpty(string argument, string value, bool reference = false)
         {
-            Check.NotNull(argument, value, reference);
+            NotNull(argument, value, reference);
 
             if (value.Length == 0)
             {
@@ -112,7 +111,7 @@ namespace Lucene.Net
         [DebuggerStepThrough]
         public static string NotEmptyOrWhitespace(string argument, string value, bool reference = false)
         {
-            Check.NotEmpty(argument, value, reference);
+            NotEmpty(argument, value, reference);
 
             if (value.Trim().Length == 0)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Lucene.Net.Core.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.Core.csproj b/src/Lucene.Net.Core/Lucene.Net.Core.csproj
index 58dd3ea..a248120 100644
--- a/src/Lucene.Net.Core/Lucene.Net.Core.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.Core.csproj
@@ -22,7 +22,7 @@
 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
-    <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     <ProjectGuid>{AD8901C0-209D-4132-80AA-257DBACEECB4}</ProjectGuid>
@@ -33,8 +33,8 @@
     <DefaultLanguage>en-US</DefaultLanguage>
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <TargetFrameworkProfile>Profile151</TargetFrameworkProfile>
-    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
     <RestorePackages>true</RestorePackages>
   </PropertyGroup>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs b/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
index c829ee2..9e9d13b 100644
--- a/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
+++ b/src/Lucene.Net.Core/Support/AtomicReferenceArray.cs
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-
 namespace Lucene.Net.Support
 {
     /// <summary>
     /// Class AtomicReferenceArray.
     /// </summary>
     /// <typeparam name="T"></typeparam>
+    // ReSharper disable CSharpWarnings::CS1574
     public class AtomicReferenceArray<T>
     {
         // ReSharper disable once StaticFieldInGenericType
-        private static readonly object s_syncLock = new object();
+        private static readonly object SYNC_LOCK = new object();
         private readonly T[] array;
 
 
@@ -90,7 +90,7 @@ namespace Lucene.Net.Support
         /// <returns><c>true</c> if the index was updated, <c>false</c> otherwise.</returns>
         public bool CompareAndSet(int index, T expected, T value)
         {
-            lock (s_syncLock)
+            lock (SYNC_LOCK)
             {
                 var currentValue = this.array[index];
                 if (!expected.Equals(currentValue)) 
@@ -129,7 +129,7 @@ namespace Lucene.Net.Support
         {
             //Check.InRangeOfLength(0, this.Length, index);
 
-            lock (s_syncLock)
+            lock (SYNC_LOCK)
             {
                 var currentValue = this.array[index];
                 this.array[index] = value;
@@ -150,7 +150,7 @@ namespace Lucene.Net.Support
         {
           
 
-            lock (s_syncLock)
+            lock (SYNC_LOCK)
             {
                 array[index] = value;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/DeepCloneNotSupportedException.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/DeepCloneNotSupportedException.cs b/src/Lucene.Net.Core/Support/DeepCloneNotSupportedException.cs
index 38915ff..b17ddb3 100644
--- a/src/Lucene.Net.Core/Support/DeepCloneNotSupportedException.cs
+++ b/src/Lucene.Net.Core/Support/DeepCloneNotSupportedException.cs
@@ -27,7 +27,7 @@ namespace Lucene.Net.Support
     {
 
         /// <summary>
-        /// Initizalizes a new instance of <see cref="DeepCloneNotSupportedException"/> class.
+        /// Initializes a new instance of <see cref="DeepCloneNotSupportedException"/> class.
         /// </summary>
         public DeepCloneNotSupportedException() { }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/EnumUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/EnumUtil.cs b/src/Lucene.Net.Core/Support/EnumUtil.cs
index e7f2ba7..fe1a006 100644
--- a/src/Lucene.Net.Core/Support/EnumUtil.cs
+++ b/src/Lucene.Net.Core/Support/EnumUtil.cs
@@ -22,6 +22,10 @@ namespace Lucene.Net
     using System.Linq;
     using System.Reflection;
 
+    /// <summary>
+    /// Utility methods for working with <c>enum</c>s
+    /// </summary>
+    // ReSharper disable CSharpWarnings::CS1574
     public static class EnumUtil
     {
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/HashMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/HashMap.cs b/src/Lucene.Net.Core/Support/HashMap.cs
index 3dfa99e..5e3380b 100644
--- a/src/Lucene.Net.Core/Support/HashMap.cs
+++ b/src/Lucene.Net.Core/Support/HashMap.cs
@@ -27,8 +27,8 @@ namespace Lucene.Net.Support
     /// A C# emulation of the <a href="http://download.oracle.com/javase/1,5.0/docs/api/java/util/HashMap.html">Java Hashmap</a>
     /// <para>
     /// A <see cref="Dictionary{TKey, TValue}" /> is a close equivalent to the Java
-    /// Hashmap.  One difference java implementation of the class is that
-    /// the Hashmap supports both null keys and values, where the C# Dictionary
+    /// HashMap.  One difference java implementation of the class is that
+    /// the HashMap supports both null keys and values, where the C# Dictionary
     /// only supports null values not keys.  Also, <c>V Get(TKey)</c>
     /// method in Java returns null if the key doesn't exist, instead of throwing
     /// an exception.  This implementation doesn't throw an exception when a key 
@@ -42,26 +42,27 @@ namespace Lucene.Net.Support
     /// null).  Therefore, if the expected behavior of the java code is to execute code
     /// based on if the key exists, when the key is an integer type, it will return 0 instead of null.
     /// </para>
-    /// <remaks>
+    /// <remarks>
     /// Consider also implementing IDictionary, IEnumerable, and ICollection
     /// like <see cref="Dictionary{TKey, TValue}" /> does, so HashMap can be
     /// used in substituted in place for the same interfaces it implements.
-    /// </remaks>
+    /// </remarks>
     /// </summary>
     /// <typeparam name="TKey">The type of keys in the dictionary</typeparam>
     /// <typeparam name="TValue">The type of values in the dictionary</typeparam>
+    // ReSharper disable CSharpWarnings::CS1574
     [Serializable]
     public class HashMap<TKey, TValue> : IDictionary<TKey, TValue>
     {
-        internal IEqualityComparer<TKey> _comparer;
-        internal IDictionary<TKey, TValue> _dict;
+        internal IEqualityComparer<TKey> Comparer;
+        internal IDictionary<TKey, TValue> Dictionary;
 
         // Indicates if a null key has been assigned, used for iteration
-        private bool _hasNullValue;
+        private bool hasNullValue;
         // stores the value for the null key
-        private TValue _nullValue;
-        // Indicates the type of key is a non-nullable valuetype
-        private bool _isValueType;
+        private TValue nullValue;
+        // Indicates the type of key is a non-nullable value type
+        private readonly bool isValueType;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="HashMap{TKey, TValue}"/> class.
@@ -107,20 +108,21 @@ namespace Lucene.Net.Support
         {
             foreach (var kvp in collection)
             {
+                // ReSharper disable once DoNotCallOverridableMethodsInConstructor
                 Add(kvp.Key, kvp.Value);
             }
         }
 
-        internal HashMap(IDictionary<TKey, TValue> wrappedDict, IEqualityComparer<TKey> comparer)
+        internal HashMap(IDictionary<TKey, TValue> wrappedDictionary, IEqualityComparer<TKey> comparer)
         {
-            _comparer = EqualityComparer<TKey>.Default;
-            _dict = wrappedDict;
-            _hasNullValue = false;
+            this.Comparer = comparer ?? EqualityComparer<TKey>.Default;
+            this.Dictionary = wrappedDictionary;
+            this.hasNullValue = false;
 
 
             if (typeof(TKey).GetTypeInfo().IsValueType)
             {
-                _isValueType = Nullable.GetUnderlyingType(typeof(TKey)) == null;
+                this.isValueType = Nullable.GetUnderlyingType(typeof(TKey)) == null;
             }
         }
 
@@ -132,10 +134,10 @@ namespace Lucene.Net.Support
         /// <returns>True, if the <see cref="HashMap{TKey, TValue}"/> contains the value; otherwise, false.</returns>
         public bool ContainsValue(TValue value)
         {
-            if (!_isValueType && _hasNullValue && _nullValue.Equals(value))
+            if (!this.isValueType && this.hasNullValue && this.nullValue.Equals(value))
                 return true;
 
-            return _dict.Values.Contains(value);
+            return this.Dictionary.Values.Contains(value);
         }
 
         /*
@@ -166,11 +168,11 @@ namespace Lucene.Net.Support
         /// </returns>
         public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
         {
-            if (!_isValueType && _hasNullValue)
+            if (!this.isValueType && this.hasNullValue)
             {
-                yield return new KeyValuePair<TKey, TValue>(default(TKey), _nullValue);
+                yield return new KeyValuePair<TKey, TValue>(default(TKey), this.nullValue);
             }
-            foreach (var kvp in _dict)
+            foreach (var kvp in this.Dictionary)
             {
                 yield return kvp;
             }
@@ -195,9 +197,9 @@ namespace Lucene.Net.Support
         /// </summary>
         public void Clear()
         {
-            _hasNullValue = false;
-            _nullValue = default(TValue);
-            _dict.Clear();
+            this.hasNullValue = false;
+            this.nullValue = default(TValue);
+            this.Dictionary.Clear();
         }
 
 
@@ -210,12 +212,12 @@ namespace Lucene.Net.Support
         ///     false.</returns>
         public bool Contains(KeyValuePair<TKey, TValue> item)
         {
-            if (!_isValueType && _comparer.Equals(item.Key, default(TKey)))
+            if (!this.isValueType && this.Comparer.Equals(item.Key, default(TKey)))
             {
-                return _hasNullValue && EqualityComparer<TValue>.Default.Equals(item.Value, _nullValue);
+                return this.hasNullValue && EqualityComparer<TValue>.Default.Equals(item.Value, this.nullValue);
             }
 
-            return ((ICollection<KeyValuePair<TKey, TValue>>)_dict).Contains(item);
+            return this.Dictionary.Contains(item);
         }
 
         /// <summary>
@@ -224,7 +226,7 @@ namespace Lucene.Net.Support
         /// </summary>
         /// <param name="array">
         ///  The one-dimensional <see cref="System.Array"/> that is the destination of the elements copied
-        ///  from <see cref="HashMap{TKey, TValue}"> . The <see cref="System.Array"/> must have zero-based
+        ///  from <see cref="HashMap{TKey, TValue}" /> . The <see cref="System.Array"/> must have zero-based
         ///     indexing.
         /// </param>
         /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
@@ -233,12 +235,12 @@ namespace Lucene.Net.Support
             Check.NotNull("array", array);
 
             if (arrayIndex < 0)
-                throw new ArgumentOutOfRangeException("arrayIndex is must be 0 or greater.");
+                throw new ArgumentOutOfRangeException("arrayIndex", "arrayIndex must be 0 or greater.");
 
-            ((ICollection<KeyValuePair<TKey, TValue>>)_dict).CopyTo(array, arrayIndex);
-            if (!_isValueType && _hasNullValue)
+            this.Dictionary.CopyTo(array, arrayIndex);
+            if (!this.isValueType && this.hasNullValue)
             {
-                array[array.Length - 1] = new KeyValuePair<TKey, TValue>(default(TKey), _nullValue);
+                array[array.Length - 1] = new KeyValuePair<TKey, TValue>(default(TKey), this.nullValue);
             }
 
 
@@ -254,17 +256,17 @@ namespace Lucene.Net.Support
         /// </returns>
         public bool Remove(KeyValuePair<TKey, TValue> item)
         {
-            if (!_isValueType && _comparer.Equals(item.Key, default(TKey)))
+            if (!this.isValueType && this.Comparer.Equals(item.Key, default(TKey)))
             {
-                if (!_hasNullValue)
+                if (!this.hasNullValue)
                     return false;
 
-                _hasNullValue = false;
-                _nullValue = default(TValue);
+                this.hasNullValue = false;
+                this.nullValue = default(TValue);
                 return true;
             }
 
-            return ((ICollection<KeyValuePair<TKey, TValue>>)_dict).Remove(item);
+            return this.Dictionary.Remove(item);
         }
 
         /// <summary>
@@ -272,7 +274,7 @@ namespace Lucene.Net.Support
         /// </summary>
         public int Count
         {
-            get { return _dict.Count + (_hasNullValue ? 1 : 0); }
+            get { return this.Dictionary.Count + (this.hasNullValue ? 1 : 0); }
         }
 
         /// <summary>
@@ -301,16 +303,16 @@ namespace Lucene.Net.Support
         /// </returns>
         public bool ContainsKey(TKey key)
         {
-            if (!_isValueType && _comparer.Equals(key, default(TKey)))
+            if (!this.isValueType && this.Comparer.Equals(key, default(TKey)))
             {
-                if (_hasNullValue)
+                if (this.hasNullValue)
                 {
                     return true;
                 }
                 return false;
             }
 
-            return _dict.ContainsKey(key);
+            return this.Dictionary.ContainsKey(key);
         }
 
         /// <summary>
@@ -320,14 +322,14 @@ namespace Lucene.Net.Support
         /// <param name="value">The object associated with the key.</param>
         public virtual void Add(TKey key, TValue value)
         {
-            if (!_isValueType && _comparer.Equals(key, default(TKey)))
+            if (!this.isValueType && this.Comparer.Equals(key, default(TKey)))
             {
-                _hasNullValue = true;
-                _nullValue = value;
+                this.hasNullValue = true;
+                this.nullValue = value;
             }
             else
             {
-                _dict[key] = value;
+                this.Dictionary[key] = value;
             }
         }
 
@@ -338,18 +340,12 @@ namespace Lucene.Net.Support
         /// <returns>True, if the element is successfully removed; otherwise, false. </returns>
         public bool Remove(TKey key)
         {
+            if (this.isValueType || !this.Comparer.Equals(key, default(TKey))) 
+                return this.Dictionary.Remove(key);
             
-           
-            if (!_isValueType && _comparer.Equals(key, default(TKey)))
-            {
-                _hasNullValue = false;
-                _nullValue = default(TValue);
-                return true;
-            }
-            else
-            {
-                return _dict.Remove(key);
-            }
+            this.hasNullValue = false;
+            this.nullValue = default(TValue);
+            return true;
         }
 
         /// <summary>
@@ -365,21 +361,17 @@ namespace Lucene.Net.Support
         /// </returns>
         public bool TryGetValue(TKey key, out TValue value)
         {
-            if (!_isValueType && _comparer.Equals(key, default(TKey)))
-            {
-                if (_hasNullValue)
-                {
-                    value = _nullValue;
-                    return true;
-                }
+            if (this.isValueType || !this.Comparer.Equals(key, default(TKey)))
+                return this.Dictionary.TryGetValue(key, out value);
 
-                value = default(TValue);
-                return false;
-            }
-            else
+            if (this.hasNullValue)
             {
-                return _dict.TryGetValue(key, out value);
+                value = this.nullValue;
+                return true;
             }
+
+            value = default(TValue);
+            return false;
         }
 
         /// <summary>
@@ -391,15 +383,15 @@ namespace Lucene.Net.Support
         {
             get
             {
-                if (!_isValueType && _comparer.Equals(key, default(TKey)))
+                if (!this.isValueType && this.Comparer.Equals(key, default(TKey)))
                 {
-                    if (!_hasNullValue)
+                    if (!this.hasNullValue)
                     {
                         return default(TValue);
                     }
-                    return _nullValue;
+                    return this.nullValue;
                 }
-                return _dict.ContainsKey(key) ? _dict[key] : default(TValue);
+                return this.Dictionary.ContainsKey(key) ? this.Dictionary[key] : default(TValue);
             }
             set { Add(key, value); }
         }
@@ -408,12 +400,12 @@ namespace Lucene.Net.Support
         {
             get
             {
-                if (!_hasNullValue) return _dict.Keys;
+                if (!this.hasNullValue) return this.Dictionary.Keys;
 
                 // Using a List<T> to generate an ICollection<TKey>
                 // would incur a costly copy of the dict's KeyCollection
                 // use out own wrapper instead
-                return new NullKeyCollection(_dict);
+                return new NullKeyCollection(this.Dictionary);
             }
         }
 
@@ -421,12 +413,12 @@ namespace Lucene.Net.Support
         {
             get
             {
-                if (!_hasNullValue) return _dict.Values;
+                if (!this.hasNullValue) return this.Dictionary.Values;
 
                 // Using a List<T> to generate an ICollection<TValue>
                 // would incur a costly copy of the dict's ValueCollection
                 // use out own wrapper instead
-                return new NullValueCollection(_dict, _nullValue);
+                return new NullValueCollection(this.Dictionary, this.nullValue);
             }
         }
 
@@ -440,22 +432,22 @@ namespace Lucene.Net.Support
         /// </summary>
         class NullValueCollection : ICollection<TValue>
         {
-            private readonly TValue _nullValue;
-            private readonly IDictionary<TKey, TValue> _internalDict;
+            private readonly TValue nullValue;
+            private readonly IDictionary<TKey, TValue> internalDictionary;
 
-            public NullValueCollection(IDictionary<TKey, TValue> dict, TValue nullValue)
+            public NullValueCollection(IDictionary<TKey, TValue> dictionary, TValue nullValue)
             {
-                _internalDict = dict;
-                _nullValue = nullValue;
+                this.internalDictionary = dictionary;
+                this.nullValue = nullValue;
             }
 
             #region Implementation of IEnumerable
 
             public IEnumerator<TValue> GetEnumerator()
             {
-                yield return _nullValue;
+                yield return nullValue;
 
-                foreach (var val in _internalDict.Values)
+                foreach (var val in internalDictionary.Values)
                 {
                     yield return val;
                 }
@@ -477,7 +469,7 @@ namespace Lucene.Net.Support
 
             public int Count
             {
-                get { return _internalDict.Count + 1; }
+                get { return internalDictionary.Count + 1; }
             }
 
             public bool IsReadOnly
@@ -520,17 +512,17 @@ namespace Lucene.Net.Support
         /// </summary>
         class NullKeyCollection : ICollection<TKey>
         {
-            private readonly IDictionary<TKey, TValue> _internalDict;
+            private readonly IDictionary<TKey, TValue> internalDictionary;
 
-            public NullKeyCollection(IDictionary<TKey, TValue> dict)
+            public NullKeyCollection(IDictionary<TKey, TValue> dictionary)
             {
-                _internalDict = dict;
+                this.internalDictionary = dictionary;
             }
 
             public IEnumerator<TKey> GetEnumerator()
             {
                 yield return default(TKey);
-                foreach (var key in _internalDict.Keys)
+                foreach (var key in internalDictionary.Keys)
                 {
                     yield return key;
                 }
@@ -548,7 +540,7 @@ namespace Lucene.Net.Support
 
             public int Count
             {
-                get { return _internalDict.Count + 1; }
+                get { return internalDictionary.Count + 1; }
             }
 
             public bool IsReadOnly

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/ICharSequence.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ICharSequence.cs b/src/Lucene.Net.Core/Support/ICharSequence.cs
index 924b9c3..c3f5486 100644
--- a/src/Lucene.Net.Core/Support/ICharSequence.cs
+++ b/src/Lucene.Net.Core/Support/ICharSequence.cs
@@ -18,7 +18,7 @@
 namespace Lucene.Net.Support
 {
     /// <summary>
-    /// A readable sequence of <see cref="System.Char"/> values.
+    /// A readable sequence of <see cref="char"/> values.
     /// </summary>
     public interface ICharSequence
     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/ICloneable.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ICloneable.cs b/src/Lucene.Net.Core/Support/ICloneable.cs
index 0819ad5..992d1a5 100644
--- a/src/Lucene.Net.Core/Support/ICloneable.cs
+++ b/src/Lucene.Net.Core/Support/ICloneable.cs
@@ -17,6 +17,7 @@
 
 namespace Lucene.Net.Support
 {
+    // ReSharper disable once CSharpWarnings::CS1584
     /// <summary>
     /// Supports cloning, which creates a new instance of a class with the same value as an existing instance.
     /// </summary>
@@ -27,7 +28,7 @@ namespace Lucene.Net.Support
     ///         <see href="http://blogs.msdn.com/b/brada/archive/2003/04/09/49935.aspx">Brad Abrams even suggests not to use it.</see>
     ///     </para>
     ///     <para>
-    ///         The Lucene code base makes heavy use of the Java equivelant of ICloneable in its public APIs. In order to help keep on 
+    ///         The Lucene code base makes heavy use of the Java equivalent of ICloneable in its public APIs. In order to help keep on 
     ///         par with Lucene.Net's parent project and keep with design standards, the <see cref="ICloneable.Clone(bool)"/> method
     ///         has a parameter that instructs the instance to make a deep clone when true.  If a deep or shallow clone is not supported,
     ///         an exception must be thrown. 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs b/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
index 786ffc5..e31b742 100644
--- a/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
+++ b/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
@@ -17,8 +17,6 @@
 
 namespace Lucene.Net.Support
 {
-    using System;
-
     /// <summary>
     /// Extension methods for numeric types to enable the same functionality that
     /// currently exists in the standard java libraries. 
@@ -30,7 +28,7 @@ namespace Lucene.Net.Support
         /// </summary>
         static class DeBruijn32
         {
-            static int[] s_positions = new int[32]
+            static readonly int[] POSITIONS = 
 	        {
 	            0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
 	            31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
@@ -41,8 +39,8 @@ namespace Lucene.Net.Support
             /// </summary>
             public static int Position(int number)
             {
-                uint res = unchecked((uint)(number & -number) * 0x077CB531U) >> 27;
-                return s_positions[res];
+                var res = unchecked((uint)(number & -number) * 0x077CB531U) >> 27;
+                return POSITIONS[res];
             }
         }
 
@@ -51,18 +49,18 @@ namespace Lucene.Net.Support
         {
 
 
-            static int[] s_positions = new int[64] {
+            static readonly int[] POSITIONS = {
                 0,  1,  2, 53,  3,  7, 54, 27, 4, 38, 41,  8, 34, 55, 48, 28,
                 62,  5, 39, 46, 44, 42, 22,  9, 24, 35, 59, 56, 49, 18, 29, 11,
                 63, 52,  6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,
-                51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12,
+                51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12
             };
 
             public static int Position(long value)
             {
 
                 var result = unchecked((uint)(value & -value) * 0x022fdd63cc95386d) >> 58;
-                return s_positions[result];
+                return POSITIONS[result];
             }
         }
 
@@ -74,13 +72,13 @@ namespace Lucene.Net.Support
         /// <remarks>
         ///     <para>
         ///         We're using the De Bruijn sequences based upon the various bit twiddling hacks found in 
-        ///         an online paper stanford <see cref="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup" />
+        ///         an <a href="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup">online paper at stanford</a>
         ///     </para>
         ///     <para>
         ///          It should be faster than Java's native 
-        ///          <see href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/Integer.java#Integer.numberOfTrailingZeros%28int%29">
+        ///          <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/Integer.java#Integer.numberOfTrailingZeros%28int%29">
         ///          Long.numberOfTrailingZeros
-        ///          </see> which uses the binary search method of finding trailing zeros.  
+        ///          </a> which uses the binary search method of finding trailing zeros.  
         ///     </para>
         /// </remarks>
         /// <returns>The number of trailing zeros.</returns>
@@ -89,6 +87,7 @@ namespace Lucene.Net.Support
             return DeBruijn32.Position(value);
         }
 
+        // ReSharper disable once CSharpWarnings::CS1584
         /// <summary>
         /// Returns the number of trailing zeros. i.e 100 has two trailing zeros.
         /// </summary>
@@ -96,7 +95,8 @@ namespace Lucene.Net.Support
         /// <remarks>
         ///     <para>
         ///         We're using the De Bruijn sequences based upon the various bit twiddling hacks found in 
-        ///         an online paper stanford <see cref="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup" />
+
+        ///         an online paper stanford <see href="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup" />
         ///     </para>
         ///     <para>
         ///          It should be faster than Java's native 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/SerializableAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/SerializableAttribute.cs b/src/Lucene.Net.Core/Support/SerializableAttribute.cs
index a632ec9..ba5d7a6 100644
--- a/src/Lucene.Net.Core/Support/SerializableAttribute.cs
+++ b/src/Lucene.Net.Core/Support/SerializableAttribute.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Support
     ///  Indicates that a class can be serialized. This class cannot be inherited. 
     ///  This is a placeholder for the SerializableAttribute that is not present in smaller
     ///  version of the .NET framework.
-    /// <summary>
+    /// </summary>
     [AttributeUsage(AttributeTargets.Class)]
     public sealed class SerializableAttribute : Attribute
     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/ShallowCloneNotSupportedException.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ShallowCloneNotSupportedException.cs b/src/Lucene.Net.Core/Support/ShallowCloneNotSupportedException.cs
index 5cc187d..8dbef5f 100644
--- a/src/Lucene.Net.Core/Support/ShallowCloneNotSupportedException.cs
+++ b/src/Lucene.Net.Core/Support/ShallowCloneNotSupportedException.cs
@@ -26,12 +26,12 @@ namespace Lucene.Net.Support
     public class ShallowCloneNotSupportedException : NotSupportedException
     {
         /// <summary>
-        /// Initizalizes a new instance of <see cref="ShallowCloneNotSupportedException"/> class.
+        /// Initializes a new instance of <see cref="ShallowCloneNotSupportedException"/> class.
         /// </summary>        
         public ShallowCloneNotSupportedException() { }
 
         /// <summary>
-        /// Initizalizes a new instance of <see cref="ShallowCloneNotSupportedException"/> class with the type
+        /// Initializes a new instance of <see cref="ShallowCloneNotSupportedException"/> class with the type
         /// that does not allow shallow clones.
         /// </summary>        
         /// <param name="type">The class type that does not allow shallow clones.</param>
@@ -42,13 +42,13 @@ namespace Lucene.Net.Support
         }
 
         /// <summary>
-        /// Initizalizes a new instance of <see cref="ShallowCloneNotSupportedException"/> class with a specified message.
+        /// Initializes a new instance of <see cref="ShallowCloneNotSupportedException"/> class with a specified message.
         /// </summary>
         /// <param name="message">A string that describes the error that is meant to be understood by humans.</param>
         public ShallowCloneNotSupportedException(string message) : base(message) { }
 
         /// <summary>
-        /// Initizalizes a new instance of <see cref="ShallowCloneNotSupportedException"/> class with a specified message and a 
+        /// Initializes a new instance of <see cref="ShallowCloneNotSupportedException"/> class with a specified message and a 
         /// reference to the inner exception that caused this exception.
         /// </summary>
         /// <param name="message">A string that describes the error that is meant to be understood by humans.</param>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/StringExtensionMethods.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/StringExtensionMethods.cs b/src/Lucene.Net.Core/Support/StringExtensionMethods.cs
index 5167fa0..8a832f8 100644
--- a/src/Lucene.Net.Core/Support/StringExtensionMethods.cs
+++ b/src/Lucene.Net.Core/Support/StringExtensionMethods.cs
@@ -17,11 +17,10 @@
 
 namespace Lucene.Net.Support
 {
-    using System.Text;
     using System.Text.RegularExpressions;
 
     /// <summary>
-    /// String extenion methods to help with Java to C# conversion
+    /// String extension methods to help with Java to C# conversion
     /// </summary>
     public static class StringExtensionMethods
     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs b/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
index e7ca972..02254d4 100644
--- a/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
+++ b/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
@@ -20,6 +20,7 @@ namespace Lucene.Net.Support
     /// <summary>
     /// Summary description for SupportExtensionMethods
     /// </summary>
+    // ReSharper disable CSharpWarnings::CS1574
     public static class SupportExtensionMethods
     {
         /// <summary>
@@ -41,7 +42,7 @@ namespace Lucene.Net.Support
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///     <see cref="https://code.google.com/p/smhasher/wiki/MurmurHash3">MurmurHash3</see>
+        ///     <a href="https://code.google.com/p/smhasher/wiki/MurmurHash3">MurmurHash3</a>
         ///     </para>
         /// </remarks>
         /// <param name="value">The value, usually from a <see cref="System.Object.GetHashCode"/>.</param>
@@ -56,7 +57,7 @@ namespace Lucene.Net.Support
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///     <see cref="https://code.google.com/p/smhasher/wiki/MurmurHash3">MurmurHash3</see>
+        ///     <a href="https://code.google.com/p/smhasher/wiki/MurmurHash3">MurmurHash3</a>
         ///     </para>
         /// </remarks>
         /// <param name="value">The value, usually from a <see cref="System.Object.GetHashCode"/>.</param>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Util/ArrayInPlaceMergeSorter`.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ArrayInPlaceMergeSorter`.cs b/src/Lucene.Net.Core/Util/ArrayInPlaceMergeSorter`.cs
index bb9c39d..01f7f0e 100644
--- a/src/Lucene.Net.Core/Util/ArrayInPlaceMergeSorter`.cs
+++ b/src/Lucene.Net.Core/Util/ArrayInPlaceMergeSorter`.cs
@@ -17,7 +17,6 @@
 
 namespace Lucene.Net.Util
 {
-    using System;
     using System.Collections.Generic;
 
     /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Util/ArrayUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ArrayUtil.cs b/src/Lucene.Net.Core/Util/ArrayUtil.cs
index 57822b5..078aaf3 100644
--- a/src/Lucene.Net.Core/Util/ArrayUtil.cs
+++ b/src/Lucene.Net.Core/Util/ArrayUtil.cs
@@ -26,6 +26,7 @@ namespace Lucene.Net.Util
     /// <summary>
     /// Utility methods for manipulating arrays.
     /// </summary>
+    // ReSharper disable CSharpWarnings::CS1574
     public static class ArrayUtil
     {
 
@@ -38,35 +39,31 @@ namespace Lucene.Net.Util
         /// <param name="array">The array to base the resize on.</param>
         /// <param name="minSize">The minimum size to grow the array.</param>
         /// <returns>The resized array.</returns>
-        /// <exception cref="ArgumentException">Throws when <paramref name="minTargetSize"/> is less than zero.</exception>
+        /// <exception cref="System.ArgumentException">Throws when <paramref name="minSize"/> is less than zero.</exception>
         public static T[] Grow<T>(this T[] array, int minSize = 1)
         {
             Debug.Assert(typeof(T).GetTypeInfo().IsPrimitive, "Type T must be primitive");
             Debug.Assert(minSize >= 0, "targetSize must be positive");
 
-            if (array.Length < minSize)
-            {
-                int capacity = Oversize(minSize, RamUsageEstimator.PrimitiveSizes[typeof(T)]);
-                var oversizedArray = new T[capacity];
-                Array.Copy(array, 0, oversizedArray, 0, array.Length);
-
-                return oversizedArray;
-            }
-            else
-            {
+            if (array.Length >= minSize) 
                 return array;
-            }
+            
+            var capacity = Oversize(minSize, RamUsageEstimator.PRIMITIVE_SIZES[typeof(T)]);
+            var oversizedArray = new T[capacity];
+            Array.Copy(array, 0, oversizedArray, 0, array.Length);
+
+            return oversizedArray;
         }
 
 
         /// <summary>
-        /// Returns a hashcode for an array.
+        /// Returns a hash code for an array.
         /// </summary>
         /// <typeparam name="T">The element type for the array.</typeparam>
-        /// <param name="array">The target array to create a hashcode.</param>
+        /// <param name="array">The target array to create a hash code.</param>
         /// <param name="start">The starting position for a loop.</param>
         /// <param name="end">The number of iterations for the loop to perform.</param>
-        /// <returns>The hashcode.</returns>
+        /// <returns>The hash code.</returns>
         public static int CreateHashCode<T>(this T[] array, int start, int end) where T : struct
         {
             var code = 0;
@@ -86,7 +83,7 @@ namespace Lucene.Net.Util
         /// <param name="minTargetSize">The minium size for the oversize.</param>
         /// <param name="bytesPerElement">The number of bytes an element of the array will allocate in memory.</param>
         /// <returns>The new capacity size.</returns>
-        /// <exception cref="ArgumentException">Throws when <paramref name="minTargetSize"/> is less than zero.</exception>
+        /// <exception cref="System.ArgumentException">Throws when <paramref name="minTargetSize"/> is less than zero.</exception>
         public static int Oversize(int minTargetSize, int bytesPerElement)
         {
             // catch usage that accidentally overflows int
@@ -106,7 +103,7 @@ namespace Lucene.Net.Util
             if (extra < 3)
             {
                 // for very small arrays, where constant overhead of
-                // realloc is presumably relatively high, we grow
+                // reallocate memory block is presumably relatively high, we grow
                 // faster
                 extra = 3;
             }
@@ -134,31 +131,30 @@ namespace Lucene.Net.Util
                     case 1:
                         // round up to multiple of 8
                         return (newSize + 7) & 0x7ffffff8;
-                    case 8:
-                    // no rounding
+                    // case 8 falls through. 
+              
                     default:
                         // odd (invalid?) size
                         return newSize;
                 }
             }
-            else
+            // round up to 4 byte alignment in 64bit env
+            switch (bytesPerElement)
             {
-                // round up to 4 byte alignment in 64bit env
-                switch (bytesPerElement)
-                {
-                    case 2:
-                        // round up to multiple of 2
-                        return (newSize + 1) & 0x7ffffffe;
-                    case 1:
-                        // round up to multiple of 4
-                        return (newSize + 3) & 0x7ffffffc;
-                    case 4:
-                    case 8:
+                case 2:
+                    // round up to multiple of 2
+                    return (newSize + 1) & 0x7ffffffe;
+                case 1:
+                    // round up to multiple of 4
+                    return (newSize + 3) & 0x7ffffffc;
+                    
+                    // fall through
+                    // case 4:
+                    // case 8:
                     // no rounding
-                    default:
-                        // odd (invalid?) size
-                        return newSize;
-                }
+                default:
+                    // odd (invalid?) size
+                    return newSize;
             }
         }
 
@@ -197,7 +193,8 @@ namespace Lucene.Net.Util
         /// <returns>The integer value that was parsed from <pararef name="chars" />.</returns>
         /// <exception cref="ArgumentNullException">Throws when <paramref name="chars"/> is null.</exception>
         /// <exception cref="ArgumentException">Throws when <paramref name="chars"/> is empty.</exception>
-        /// <exception cref="ArgumentOutOfRangeException">
+
+        /// <exception cref="System.ArgumentOutOfRangeException">
         ///     <list type="bullet">
         ///         <item>Throws when <paramref name="offset"/> is less than zero or greater than <paramref name="chars"/>.Length.</item>
         ///         <item>Throws when <paramref name="limit"/> is greater than <paramref name="chars"/>.Length.</item>
@@ -207,7 +204,7 @@ namespace Lucene.Net.Util
         /// <exception cref="FormatException">Throws when a character cannot be translated into a integer.</exception>
         public static int ParseInt(this char[] chars, int offset = 0, int limit = -1, int radix = 10)
         {
-            Check.NotNull("chars", chars, false);
+            Check.NotNull("chars", chars);
             Check.Condition(chars.Length == 0, "chars", "The parameter, chars, must not be an empty array.");
             Check.Condition<ArgumentOutOfRangeException>(
                 offset < 0 || offset > chars.Length,  
@@ -232,7 +229,7 @@ namespace Lucene.Net.Util
 
             Check.Condition<FormatException>(negative && limit == 1, "A negative sign, '-', cannot be converted into an integer.");
 
-            if (negative == true)
+            if (negative)
             {
                 offset++;
                 limit--;
@@ -244,23 +241,24 @@ namespace Lucene.Net.Util
         // parse() in Java
         private static int ParseInt(char[] chars, int offset, int len, int radix, bool negative)
         {
-            int max = int.MinValue / radix;
-            int result = 0;
-            for (int i = 0; i < len; i++)
+            var max = int.MinValue / radix;
+            var result = 0;
+            for (var i = 0; i < len; i++)
             {
-                int digit = (int)System.Char.GetNumericValue(chars[i + offset]);
+                var digit = (int)Char.GetNumericValue(chars[i + offset]);
                 if (digit == -1)
                 {
-                    throw new System.FormatException("Unable to parse");
+                    throw new FormatException("Unable to parse");
                 }
                 if (max > result)
                 {
-                    throw new System.FormatException("Unable to parse");
+                    throw new FormatException("Unable to parse");
                 }
-                int next = result * radix - digit;
+                
+                var next = result * radix - digit;
                 if (next > result)
                 {
-                    throw new System.FormatException("Unable to parse");
+                    throw new FormatException("Unable to parse");
                 }
                 result = next;
             }
@@ -270,7 +268,7 @@ namespace Lucene.Net.Util
                 result = -result;
                 if (result < 0)
                 {
-                    throw new System.FormatException("Unable to parse");
+                    throw new FormatException("Unable to parse");
                 }
             }
             return result;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Util/BitUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/BitUtil.cs b/src/Lucene.Net.Core/Util/BitUtil.cs
index 8ee0581..d0cea31 100644
--- a/src/Lucene.Net.Core/Util/BitUtil.cs
+++ b/src/Lucene.Net.Core/Util/BitUtil.cs
@@ -21,12 +21,14 @@ namespace Lucene.Net.Util
     /// <summary>
     ///  A variety of high efficiency bit twiddling routines.
     ///  </summary>
+    // ReSharper disable CSharpWarnings::CS1574
     public static class BitUtil
     {
         /// <summary>
         /// table of bytes
         /// </summary>
-        private static readonly byte[] BYTE_COUNTS = new byte[] {
+        private static readonly byte[] BYTE_COUNTS =
+        {
             0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 
             1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
             1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
@@ -55,13 +57,13 @@ namespace Lucene.Net.Util
         /// <remarks>
         ///     <para>
         ///         <code language="python">
-        ///             *** the python code that generated bitlist
+        ///             *** the python code that generated bit list
         /// def bits2int(val):
         ///     arr=0
         ///     for shift in range(8,0,-1):
         ///     if val & 0x80:
-        ///         arr = (arr << 4) | shift
-        ///     val = val << 1
+        ///         arr = (arr &lt;&lt; 4) | shift
+        ///     val = val &lt;&lt; 1
         ///     return arr
         ///
         /// def int_table():
@@ -71,11 +73,12 @@ namespace Lucene.Net.Util
         ///         </code>
         ///     </para>
         ///     <para>
-        ///         0x87654321 converts to unint, so an unchecked conversion to int is required. 
+        ///         0x87654321 converts to uint, so an unchecked conversion to int is required. 
         ///     </para>
         /// </remarks>
-        private static readonly int[] BIT_LISTS = new int[] { 
-          0x0, 0x1, 0x2, 0x21, 0x3, 0x31, 0x32, 0x321, 0x4, 0x41, 0x42, 0x421, 0x43, 
+        private static readonly int[] BIT_LISTS =
+        { 
+            0x0, 0x1, 0x2, 0x21, 0x3, 0x31, 0x32, 0x321, 0x4, 0x41, 0x42, 0x421, 0x43, 
             0x431, 0x432, 0x4321, 0x5, 0x51, 0x52, 0x521, 0x53, 0x531, 0x532, 0x5321, 
             0x54, 0x541, 0x542, 0x5421, 0x543, 0x5431, 0x5432, 0x54321, 0x6, 0x61, 0x62, 
             0x621, 0x63, 0x631, 0x632, 0x6321, 0x64, 0x641, 0x642, 0x6421, 0x643, 
@@ -103,7 +106,7 @@ namespace Lucene.Net.Util
             0x87643, 0x876431, 0x876432, 0x8764321, 0x8765, 0x87651, 0x87652, 0x876521, 
             0x87653, 0x876531, 0x876532, 0x8765321, 0x87654, 0x876541, 0x876542, 
             0x8765421, 0x876543, 0x8765431, 0x8765432, unchecked((int)0x87654321)
-       };
+        };
 
         /// <summary>
         /// Gets the number of bits sets in the <paramref name="value"/>.
@@ -123,7 +126,7 @@ namespace Lucene.Net.Util
         ///     <list type="bullet">
         ///     <item>
         ///         <code>(i >>> (4 * n)) & 0x0F</code> is the offset of the n-th set bit of the given 
-        ///         byte. For example <see cref="GetBiteList"/>(12) returns 0x43.
+        ///         byte. For example <see cref="BitList(byte)"/>(12) returns 0x43.
         ///     </item>
         ///     <item>
         ///         <code>0x43 & 0x0F</code> is 3, meaning the the first bit set is at offset 3-1 = 2.
@@ -134,7 +137,8 @@ namespace Lucene.Net.Util
         ///     <item>
         ///         <code>(0x43 >>> 8) & 0x0F</code> is 0, meaning there is no more bit set in this byte.
         ///     </item>
-        ///     </para>
+        ///     </list>
+        ///     
         /// </remarks>
         /// <param name="value"></param>
         /// <returns></returns>
@@ -146,7 +150,7 @@ namespace Lucene.Net.Util
 
        
         /// <summary>
-        /// Returns the number of set bits in an array of <see cref="System.Int34"/>.
+        /// Returns the number of set bits in an array of <see cref="System.Int32"/>.
         /// </summary>
         /// <param name="array">An array of <see cref="System.Int64"/></param>
         /// <param name="wordOffset">The offset position.</param>
@@ -173,10 +177,10 @@ namespace Lucene.Net.Util
         /// <param name="wordOffset">The offset position.</param>
         /// <param name="numberOfWords">The number of words, usually the length of the first array.</param>
         /// <returns>The number of set bits.</returns>
-        public static long PopIntersect(long[] left, long[] right, int wordOffset, int numWords)
+        public static long PopIntersect(long[] left, long[] right, int wordOffset, int numberOfWords)
         {
             long popCount = 0;
-            for (int i = wordOffset, end = wordOffset + numWords; i < end; ++i)
+            for (int i = wordOffset, end = wordOffset + numberOfWords; i < end; ++i)
             {
                 popCount += BitCount(left[i] & right[i]);
             }
@@ -192,10 +196,10 @@ namespace Lucene.Net.Util
         /// <param name="wordOffset">The offset position.</param>
         /// <param name="numberOfWords">The number of words, usually the length of the first array.</param>
         /// <returns>The number of set bits.</returns>
-        public static long PopUnion(long[] left, long[] right, int wordOffset, int numWords)
+        public static long PopUnion(long[] left, long[] right, int wordOffset, int numberOfWords)
         {
             long popCount = 0;
-            for (int i = wordOffset, end = wordOffset + numWords; i < end; ++i)
+            for (int i = wordOffset, end = wordOffset + numberOfWords; i < end; ++i)
             {
                 popCount += BitCount(left[i] | right[i]);
             }
@@ -211,10 +215,10 @@ namespace Lucene.Net.Util
         /// <param name="wordOffset">The offset position.</param>
         /// <param name="numberOfWords">The number of words, usually the length of the first array.</param>
         /// <returns>The number of set bits.</returns>
-        public static long PopAndNot(long[] left, long[] right, int wordOffset, int numWords)
+        public static long PopAndNot(long[] left, long[] right, int wordOffset, int numberOfWords)
         {
             long popCount = 0;
-            for (int i = wordOffset, end = wordOffset + numWords; i < end; ++i)
+            for (int i = wordOffset, end = wordOffset + numberOfWords; i < end; ++i)
             {
                 popCount += BitCount(left[i] & ~right[i]);
             }
@@ -230,11 +234,11 @@ namespace Lucene.Net.Util
         /// <param name="wordOffset">The offset position.</param>
         /// <param name="numberOfWords">The number of words, usually the length of the first array.</param>
         /// <returns>The number of set bits.</returns>
-        public static long PopXor(long[] left, long[] right, int wordOffset, int numWords)
+        public static long PopXor(long[] left, long[] right, int wordOffset, int numberOfWords)
         {
          
             long popCount = 0;
-            for (int i = wordOffset, end = wordOffset + numWords; i < end; ++i)
+            for (int i = wordOffset, end = wordOffset + numberOfWords; i < end; ++i)
             {
                 popCount += BitCount(left[i] ^ right[i]);
             }
@@ -278,7 +282,7 @@ namespace Lucene.Net.Util
         }
 
         /// <summary>
-        /// Decode a long previously encoded with <see cref="ZigZagEndcode"/>.
+        /// Decode a long previously encoded with <see cref="ZigZagEncode(int)"/>.
         /// </summary>
         /// <param name="value">The value to be decoded.</param>
         /// <returns>The decoded value.</returns>
@@ -288,7 +292,7 @@ namespace Lucene.Net.Util
         }
 
         /// <summary>
-        /// Decode a long previously encoded with <see cref="ZigZagEndcode"/>.
+        /// Decode a long previously encoded with <see cref="ZigZagEncode(long)"/>.
         /// </summary>
         /// <param name="value">The value to be decoded.</param>
         /// <returns>The decoded value.</returns>
@@ -302,7 +306,7 @@ namespace Lucene.Net.Util
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///     <ahref="https://developers.google.com/protocol-buffers/docs/encoding#types">Zig-zag</a>
+        ///     <a href="https://developers.google.com/protocol-buffers/docs/encoding#types">Zig-zag</a>
         ///     encode the provided long. Assuming the input is a signed long whose
         ///     absolute value can be stored on <tt>n</tt> bits, the returned value will
         ///     be an unsigned long that can be stored on <tt>n+1</tt> bits.
@@ -320,7 +324,7 @@ namespace Lucene.Net.Util
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///     <ahref="https://developers.google.com/protocol-buffers/docs/encoding#types">Zig-zag</a>
+        ///     <a href="https://developers.google.com/protocol-buffers/docs/encoding#types">Zig-zag</a>
         ///     encode the provided long. Assuming the input is a signed long whose
         ///     absolute value can be stored on <tt>n</tt> bits, the returned value will
         ///     be an unsigned long that can be stored on <tt>n+1</tt> bits.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Util/Bits.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Bits.cs b/src/Lucene.Net.Core/Util/Bits.cs
index 365e6bf..90813ce 100644
--- a/src/Lucene.Net.Core/Util/Bits.cs
+++ b/src/Lucene.Net.Core/Util/Bits.cs
@@ -27,6 +27,8 @@ namespace Lucene.Net.Util
     ///     </para>
     /// </remarks>
     /// <seealso cref="IBits"/>
+    // for exceptions
+    // ReSharper disable CSharpWarnings::CS1574
     public static class Bits
     {
         public static readonly IBits[] EMPTY_ARRAY = new IBits[0];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/785acd7d/src/Lucene.Net.Core/Util/BroadWord.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/BroadWord.cs b/src/Lucene.Net.Core/Util/BroadWord.cs
index b73a68c..520129a 100644
--- a/src/Lucene.Net.Core/Util/BroadWord.cs
+++ b/src/Lucene.Net.Core/Util/BroadWord.cs
@@ -17,23 +17,22 @@
 
 namespace Lucene.Net.Util
 {
-
     using System.Diagnostics;
     using Lucene.Net.Support;
 
     /// <summary>
-    /// An implementation of Broadword for rank/select queries.
+    ///     An implementation of BroadWord for rank/select queries.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///      Methods and constants inspired by the article
-    ///     "Broadword Implementation of Rank/Select Queries" by Sebastiano Vigna, January 30, 2012 which can be 
-    ///     found in the book:
-    ///     <see href="http://www.amazon.com/Experimental-Algorithms-International-Provincetown-Proceedings/dp/3540685480">
-    ///         Experimental Algorithms: 7th International Workshop, WEA 2008 Provincetown, MA, USA, May 30 - June 1, 2008 Proceedings (Lecture Notes in Computer ... Computer Science and General Issues) 
-    ///     </see>
+    ///         Methods and constants inspired by the article
+    ///         "BroadWord Implementation of Rank/Select Queries" by Sebastiano Vigna, January 30, 2012 which can be
+    ///         found in the book:
+    ///         <see href="http://www.amazon.com/Experimental-Algorithms-International-Provincetown-Proceedings/dp/3540685480">
+    ///             Experimental Algorithms: 7th International Workshop, WEA 2008 Provincetown, MA, USA, May 30 - June 1, 2008
+    ///             Proceedings (Lecture Notes in Computer ... Computer Science and General Issues)
+    ///         </see>
     ///     </para>
-    ///     
     /// </remarks>
     public static class BroadWord
     {
@@ -46,44 +45,59 @@ namespace Lucene.Net.Util
         // Thus, there is not a valid reason to make them public.  
 
         /// <summary>
-        /// L8  denotes the constant of 8-byte-counts or 8k.
-        /// _L denotes that the number is an long format. 
+        ///     The constant for the lowest 8 bit subword.
         /// </summary>
-        private const ulong L8_L = 0x0101010101010101L;
+        /// <remarks>
+        ///     <para>
+        ///         This would be the L<sub>8</sub> expression from the paper
+        ///         that notates this is the lowest 8 bit subword constant.
+        ///     </para>
+        /// </remarks>
+        private const ulong Lowest8BitSubword = 0x0101010101010101L;
 
         /// <summary>
-        /// L9  denotes the constant of 8-byte-counts or 9k.
-        /// _L denotes that the number is an long format. 
+        ///     The constant for the lowest 9 bit subword.
         /// </summary>
-        private const ulong L9_L = 0x8040201008040201L;
+        /// <remarks>
+        ///     <para>
+        ///         This would be the L<sub>9</sub> expression from the paper
+        ///         that notates this is the lowest 9 bit subword constant.
+        ///     </para>
+        /// </remarks>
+        private const ulong Lowest9BitSubword = 0x8040201008040201L;
 
         /// <summary>
-        /// L16  denotes the constant of 16-byte-counts or 16k.
-        /// _L denotes that the number is an long format. 
+        ///     The constant for the highest 8 bit subword.
         /// </summary>
-        private const ulong L16_L = 0x0001000100010001L;
+        /// <remarks>
+        ///     <para>
+        ///         This would be the H<sub>8</sub> expression from the paper
+        ///         that notates this is the lowest 8 bit subword constant.
+        ///     </para>
+        /// </remarks>
+        private const ulong Highest8BitSubword = Lowest8BitSubword << 7;
 
+        /* unused
         /// <summary>
-        /// H8 = L8 << (8-1) .
-        /// These contain the high bit of each group of k bits.
-        /// The suffix _L indicates the long implementation.
+        /// The constant for the highest 16 bit subword.  
         /// </summary>
-        private static readonly ulong H8_L = L8_L << 7;
-
-        /* unused
-        /// H16 = L16 << (16-1) .
-        ///  These contain the high bit of each group of k bits.
-        ///  The suffix _L indicates the long implementation.
+        /// <remarks>
+        ///     <para>
+        ///         This would be the L<sub>16</sub> expression from the paper
+        ///         that notates this is the lowest 16 bit subword constant.  
+        ///     </para>
+        /// </remarks>
         private static readonly ulong H16_L = L16_L << 15; */
 
         /// <summary>
-        /// Bit count of a long.
-        /// Only here to compare the implementation with <seealso cref="Select(long,int)"/>,
-        /// normally <seealso cref="Lucene.Net.Util.BitUtil.BitCount"/> is preferable. </summary>
+        ///     Bit count of a long.
+        ///     Only here to compare the implementation with <seealso cref="Select(long,int)" />,
+        ///     normally <seealso cref="Lucene.Net.Util.BitUtil.BitCount(long)" /> is preferable.
+        /// </summary>
         /// <returns> The total number of 1 bits in x. </returns>
         public static int BitCount(long value)
         {
-            ulong x = (ulong)value;
+            var x = (ulong) value;
             // Step 0 leaves in each pair of bits the number of ones originally contained in that pair:
             x = x - ((x & 0xAAAAAAAAAAAAAAAAL) >> 1);
             // Step 1, idem for each nibble:
@@ -91,87 +105,93 @@ namespace Lucene.Net.Util
             // Step 2, idem for each byte:
             x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0FL;
             // Multiply to sum them all into the high byte, and return the high byte:
-            return (int)((x * L8_L) >> 56);
+            return (int) ((x*Lowest8BitSubword) >> 56);
         }
 
-       
+
         /// <summary>
-        /// Select a 1-bit from a long. 
+        ///     Select a 1-bit from a long.
         /// </summary>
         /// <returns> The index of the right most 1 bit in x, or if no such bit exists, 72. </returns>
         public static int Select(long value, int rank)
         {
-            
-            ulong x = (ulong)value;
-            ulong s = x;
-            uint r = (uint)rank;
-            s =  s - ((s & 0xAAAAAAAAAAAAAAAAL) >> 1); // Step 0, pairwise bitsums
+            var x = (ulong) value;
+            var s = x;
+            var r = (uint) rank;
+            s = s - ((s & 0xAAAAAAAAAAAAAAAAL) >> 1); // Step 0, pairwise bitsums
 
             // Correct a small mistake in algorithm 2:
             // Use s instead of x the second time in right shift 2, compare to Algorithm 1 in rank9 above.
-            s =  (s & 0x3333333333333333L) + ((s >> 2) & 0x3333333333333333L); // Step 1, nibblewise bitsums
+            s = (s & 0x3333333333333333L) + ((s >> 2) & 0x3333333333333333L); // Step 1, nibblewise bitsums
 
-            s = ((s + (s >> 4)) & 0x0F0F0F0F0F0F0F0FL) * L8_L;; // Step 2, bytewise bitsums
+            s = ((s + (s >> 4)) & 0x0F0F0F0F0F0F0F0FL)*Lowest8BitSubword;
+            // Step 2, bytewise bitsums
 
             // second argument of  << must be an int.  
-            var b = (ulong)((SmallerUpTo7_8(s, (r * L8_L)) >> 7) * L8_L) >> 53; // & (~7L); // Step 3, side ways addition for byte number times 8
+            var b = ((SmallerUpTo7_8(s, (r*Lowest8BitSubword)) >> 7)*Lowest8BitSubword) >> 53;
+            // & (~7L); // Step 3, side ways addition for byte number times 8
 
-            ulong l = r - (((s << 8) >> (int)b) & 0xFFL); // Step 4, byte wise rank, subtract the rank with byte at b-8, or zero for b=0;
+            var l = r - (((s << 8) >> (int) b) & 0xFFL);
+            // Step 4, byte wise rank, subtract the rank with byte at b-8, or zero for b=0;
             Debug.Assert(0L <= 1);
             //assert l < 8 : l; //fails when bit r is not available.
 
             // Select bit l from byte (x >>> b):
-            ulong spr = (((x >> (int)b) & 0xFFL) * L8_L) & L9_L; // spread the 8 bits of the byte at b over the long at L9 positions
+            var spr = (((x >> (int) b) & 0xFFL)*Lowest8BitSubword) & Lowest9BitSubword;
+            // spread the 8 bits of the byte at b over the long at L9 positions
 
             // long spr_bigger8_zero = smaller8(0L, spr); // inlined smaller8 with 0L argument:
             // FIXME: replace by biggerequal8_one formula from article page 6, line 9. four operators instead of five here.
-            ulong spr_bigger8_zero = ((H8_L - (spr & (~H8_L))) ^ (~spr)) & H8_L;
-            s =(spr_bigger8_zero >> 7) * L8_L; // Step 5, sideways byte add the 8 bits towards the high byte
+            var sprBigger8Zero = ((Highest8BitSubword - (spr & (~Highest8BitSubword))) ^ (~spr)) &
+                                   Highest8BitSubword;
+            s = (sprBigger8Zero >> 7)*Lowest8BitSubword; // Step 5, sideways byte add the 8 bits towards the high byte
 
-            int res = (int) (b + (((SmallerUpTo7_8(s, (l * L8_L)) >> 7) * L8_L) >> 56)); // Step 6
-            return res; 
-           
+            var res = (int) (b + (((SmallerUpTo7_8(s, (l*Lowest8BitSubword)) >> 7)*Lowest8BitSubword) >> 56)); // Step 6
+            return res;
         }
 
-     
+
         /// <summary>
-        /// A signed bytewise smaller &lt;<sub><small>8</small></sub> operator, for operands 0L<= x, y <=0x7L.
-        /// this uses the following numbers of basic long operations: 1 or, 2 and, 2 xor, 1 minus, 1 not. 
+        ///     A signed byte wise smaller &lt;
+        ///     <sub>
+        ///         <small>8</small>
+        ///     </sub>
+        ///     operator, for operands 0L &lt;= x, y &lt;=0x7L.
+        ///     this uses the following numbers of basic long operations: 1 or, 2 and, 2 xor, 1 minus, 1 not.
         /// </summary>
-        /// <returns> A long with bits set in the <seealso cref="#H8_L"/> positions corresponding to each input signed byte pair that compares smaller. </returns>
+        /// <returns>
+        ///     A long with bits set in the <seealso cref="Highest8BitSubword" /> positions corresponding to each input signed byte pair
+        ///     that compares smaller.
+        /// </returns>
         private static ulong SmallerUpTo7_8(ulong x, ulong y)
         {
             // See section 4, page 5, line 14 of the Vigna article:
-            return (((x | H8_L) - (y & (~H8_L))) ^ x ^ ~y) & H8_L;
+            return (((x | Highest8BitSubword) - (y & (~Highest8BitSubword))) ^ x ^ ~y) & Highest8BitSubword;
         }
 
-     
-       
-
-
 
         /// <summary>
-        /// Naive implementation of <seealso cref="Select(long,int)"/>.
-        /// Works relatively fast for low ranks. 
+        ///     Naive implementation of <seealso cref="Select(long,int)" />.
+        ///     Works relatively fast for low ranks.
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         Internally uses <see cref="Lucene.Net.Support.NumberExtensionMethods.NumberOfTrailingZeros"/> repetitively.
+        ///         Internally uses <see cref="Lucene.Net.Support.NumberExtensionMethods.NumberOfTrailingZeros(long)" /> repetitively.
         ///     </para>
         /// </remarks>
         /// <returns> The index of the r-th 1 bit in x, or if no such bit exists, 72. </returns>
         public static int SelectNaive(long x, int r)
         {
             Debug.Assert(r >= 1);
-            int s = -1;
+            var s = -1;
             while ((x != 0L) && (r > 0))
             {
-                int ntz = x.NumberOfTrailingZeros();
-                x = (long)((ulong)x >> (ntz + 1));
+                var ntz = x.NumberOfTrailingZeros();
+                x = (long) ((ulong) x >> (ntz + 1));
                 s += (ntz + 1);
                 r -= 1;
             }
-            int res = (r > 0) ? 72 : s;
+            var res = (r > 0) ? 72 : s;
             return res;
         }
     }