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

paulirwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new c2583f0a2 Replace typeof(X).Name with nameof(X) #1077 (#1091)
c2583f0a2 is described below

commit c2583f0a204c4a3d7a5c300548e1f6647888319a
Author: manognyab <[email protected]>
AuthorDate: Wed Jan 8 01:40:05 2025 +0530

    Replace typeof(X).Name with nameof(X) #1077 (#1091)
    
    * Replace typeof(X).Name with nameof(X) #1077
---
 .../Analysis/NGram/EdgeNGramTokenizerFactory.cs                |  2 +-
 .../Tools/CharacterDefinitionWriter.cs                         |  2 +-
 .../ByTask/Feeds/LongToEnglishQueryMaker.cs                    |  2 +-
 .../Flexible/Core/Builders/QueryTreeBuilder.cs                 |  2 +-
 src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs      |  4 ++--
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs            |  4 ++--
 src/Lucene.Net.TestFramework/Util/TestSecurityManager.cs       |  2 +-
 .../Flexible/Messages/MessagesTestBundle.cs                    |  2 +-
 src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs       |  2 +-
 src/Lucene.Net.Tests/Search/TestBooleanScorer.cs               |  2 +-
 src/Lucene.Net.Tests/Search/TestConstantScoreQuery.cs          |  8 ++++----
 src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs    | 10 +++++-----
 src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosReader.cs     |  4 ++--
 src/Lucene.Net/Codecs/PerField/PerFieldDocValuesFormat.cs      |  4 ++--
 src/Lucene.Net/Codecs/PerField/PerFieldPostingsFormat.cs       |  4 ++--
 src/Lucene.Net/Index/CheckIndex.cs                             |  2 +-
 src/Lucene.Net/Index/IndexUpgrader.cs                          |  4 ++--
 src/Lucene.Net/Util/CommandLineUtil.cs                         | 10 +++++-----
 18 files changed, 35 insertions(+), 35 deletions(-)

diff --git 
a/src/Lucene.Net.Analysis.Common/Analysis/NGram/EdgeNGramTokenizerFactory.cs 
b/src/Lucene.Net.Analysis.Common/Analysis/NGram/EdgeNGramTokenizerFactory.cs
index d3c3fefec..406bbec88 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/NGram/EdgeNGramTokenizerFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/NGram/EdgeNGramTokenizerFactory.cs
@@ -61,7 +61,7 @@ namespace Lucene.Net.Analysis.NGram
                 EdgeNGramTokenFilter.Side sideEnum;
                 if (!Enum.TryParse(this.side, true, out sideEnum))
                 {
-                    throw new 
ArgumentException(typeof(EdgeNGramTokenizer).Name + " does not support backward 
n-grams as of Lucene 4.4");
+                    throw new ArgumentException($"{nameof(EdgeNGramTokenizer)} 
does not support backward n-grams as of Lucene 4.4");
                 }
                 return new EdgeNGramTokenizer(m_luceneMatchVersion, input, 
minGramSize, maxGramSize);
             }
diff --git 
a/src/Lucene.Net.Analysis.Kuromoji/Tools/CharacterDefinitionWriter.cs 
b/src/Lucene.Net.Analysis.Kuromoji/Tools/CharacterDefinitionWriter.cs
index 140349113..50bc13d05 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Tools/CharacterDefinitionWriter.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Tools/CharacterDefinitionWriter.cs
@@ -76,7 +76,7 @@ namespace Lucene.Net.Analysis.Ja.Util
             // LUCENENET specific: we don't need to do a "classpath" output 
directory, since we
             // are changing the implementation to read files dynamically 
instead of making the
             // user recompile with the new files.
-            string filename = System.IO.Path.Combine(baseDir, 
typeof(CharacterDefinition).Name + CharacterDefinition.FILENAME_SUFFIX);
+            string filename = System.IO.Path.Combine(baseDir, 
nameof(CharacterDefinition) + CharacterDefinition.FILENAME_SUFFIX);
             //new File(filename).getParentFile().mkdirs();
             
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(baseDir));
             using Stream os = new FileStream(filename, FileMode.Create, 
FileAccess.Write);
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs 
b/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs
index f45945665..bcd366516 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs
@@ -78,7 +78,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
 
         public virtual void SetConfig(Config config)
         {
-            Analyzer anlzr = 
NewAnalyzerTask.CreateAnalyzer(config.Get("analyzer", 
typeof(StandardAnalyzer).Name));
+            Analyzer anlzr = 
NewAnalyzerTask.CreateAnalyzer(config.Get("analyzer", 
nameof(StandardAnalyzer)));
             m_parser = new QueryParser(
 #pragma warning disable 612, 618
                 LuceneVersion.LUCENE_CURRENT,
diff --git 
a/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs 
b/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
index dfc21e6a4..9912d3787 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
@@ -216,6 +216,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Builders
         /// This tag is used to tag the nodes in a query tree with the built 
objects
         /// produced from their own associated builder.
         /// </summary>
-        public static readonly string QUERY_TREE_BUILDER_TAGID = 
typeof(QueryTreeBuilder).Name;
+        public static readonly string QUERY_TREE_BUILDER_TAGID = 
nameof(QueryTreeBuilder);
     }
 }
diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs 
b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
index 3b2ed954b..f033c31b0 100644
--- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
@@ -153,8 +153,8 @@ namespace Lucene.Net.Search.Suggest.Fst
             {
                 throw new ArgumentException("this suggester doesn't support 
contexts");
             }
-            using FileStream tempInput = 
FileSupport.CreateTempFileAsStream(typeof(FSTCompletionLookup).Name, ".input", 
OfflineSorter.DefaultTempDir);
-            using FileStream tempSorted = 
FileSupport.CreateTempFileAsStream(typeof(FSTCompletionLookup).Name, ".sorted", 
OfflineSorter.DefaultTempDir);
+            using FileStream tempInput = 
FileSupport.CreateTempFileAsStream(nameof(FSTCompletionLookup), ".input", 
OfflineSorter.DefaultTempDir);
+            using FileStream tempSorted = 
FileSupport.CreateTempFileAsStream(nameof(FSTCompletionLookup), ".sorted", 
OfflineSorter.DefaultTempDir);
 
             OfflineSorter.ByteSequencesWriter writer = new 
OfflineSorter.ByteSequencesWriter(tempInput);
             OfflineSorter.ByteSequencesReader reader = null;
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs 
b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 743de8464..cf2d398d1 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -756,7 +756,7 @@ namespace Lucene.Net.Util
         ////        }
         ////        else
         ////        {
-        ////            Console.Out.Write(typeof(LuceneTestCase).Name + " 
WARNING: Property '" + SYSPROP_MAXFAILURES + "'=" + maxFailures + ", 'failfast' 
is" + " ignored.");
+        ////            Console.Out.Write(nameof(LuceneTestCase) + " WARNING: 
Property '" + SYSPROP_MAXFAILURES + "'=" + maxFailures + ", 'failfast' is" + " 
ignored.");
         ////        }
         ////    }
 
@@ -786,7 +786,7 @@ namespace Lucene.Net.Util
 
         /////// <summary>
         /////// By-name list of ignored types like loggers etc. </summary>
-        //////private static ISet<string> STATIC_LEAK_IGNORED_TYPES = new 
JCG.HashSet<string>(new string[] { "org.slf4j.Logger", 
"org.apache.solr.SolrLogFormatter", typeof(EnumSet).Name });
+        //////private static ISet<string> STATIC_LEAK_IGNORED_TYPES = new 
JCG.HashSet<string>(new string[] { "org.slf4j.Logger", 
"org.apache.solr.SolrLogFormatter", nameof(EnumSet) });
 
         /////// <summary>
         /////// this controls how suite-level rules are nested. It is 
important that _all_ rules declared
diff --git a/src/Lucene.Net.TestFramework/Util/TestSecurityManager.cs 
b/src/Lucene.Net.TestFramework/Util/TestSecurityManager.cs
index 6834a68f7..f6bcb5fdf 100644
--- a/src/Lucene.Net.TestFramework/Util/TestSecurityManager.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestSecurityManager.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Util
 
           public override void Run()
           {
-            const string systemClassName = typeof(System).Name, 
runtimeClassName = typeof(Runtime).Name;
+            const string systemClassName = nameof(System), runtimeClassName = 
nameof(Runtime);
             string exitMethodHit = null;
             foreach (StackTraceElement se in Thread.CurrentThread.StackTrace)
             {
diff --git 
a/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/MessagesTestBundle.cs 
b/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/MessagesTestBundle.cs
index d27d76127..85484dce1 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/MessagesTestBundle.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/MessagesTestBundle.cs
@@ -24,7 +24,7 @@
 
 //    public class MessagesTestBundle : NLS
 //    {
-//        private static readonly string BUNDLE_NAME = 
typeof(MessagesTestBundle).Name;
+//        private static readonly string BUNDLE_NAME = 
nameof(MessagesTestBundle);
 
 //        private MessagesTestBundle()
 //        {
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs 
b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
index d7d493199..d90b87427 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs
@@ -502,7 +502,7 @@ namespace Lucene.Net.Index
                 {
                     // LUCENENET specific: for these to work in release mode, 
we have added [MethodImpl(MethodImplOptions.NoInlining)]
                     // to each possible target of the StackTraceHelper. If 
these change, so must the attribute on the target methods.
-                    if 
(StackTraceHelper.DoesStackTraceContainMethod(typeof(DocFieldProcessor).Name, 
"Flush"))
+                    if 
(StackTraceHelper.DoesStackTraceContainMethod(nameof(DocFieldProcessor), 
"Flush"))
                     {
                         if (onlyOnce)
                         {
diff --git a/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs 
b/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs
index a1c8cecea..3ef3d2ea8 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanScorer.cs
@@ -196,7 +196,7 @@ namespace Lucene.Net.Search
             {
                 // Make sure we got BooleanScorer:
                 Type clazz = scorer.GetType();
-                Assert.AreEqual(typeof(FakeScorer).Name, clazz.Name, "Scorer 
is implemented by wrong class");
+                Assert.AreEqual(nameof(FakeScorer), clazz.Name, "Scorer is 
implemented by wrong class");
             }
 
             public void Collect(int doc)
diff --git a/src/Lucene.Net.Tests/Search/TestConstantScoreQuery.cs 
b/src/Lucene.Net.Tests/Search/TestConstantScoreQuery.cs
index 33ff9098f..097f0a8d3 100644
--- a/src/Lucene.Net.Tests/Search/TestConstantScoreQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestConstantScoreQuery.cs
@@ -138,13 +138,13 @@ namespace Lucene.Net.Search
                 Query csqbq = new ConstantScoreQuery(bq);
                 csqbq.Boost = 17.0f;
 
-                CheckHits(searcher, csq1, csq1.Boost, 
typeof(ConstantScoreQuery.ConstantScorer).Name, null);
-                CheckHits(searcher, csq2, csq2.Boost, 
typeof(ConstantScoreQuery.ConstantScorer).Name, 
typeof(ConstantScoreQuery.ConstantScorer).Name);
+                CheckHits(searcher, csq1, csq1.Boost, 
nameof(ConstantScoreQuery.ConstantScorer), null);
+                CheckHits(searcher, csq2, csq2.Boost, 
nameof(ConstantScoreQuery.ConstantScorer), 
nameof(ConstantScoreQuery.ConstantScorer));
 
                 // for the combined BQ, the scorer should always be 
BooleanScorer's BucketScorer, because our scorer supports out-of order 
collection!
-                string bucketScorerClass = typeof(FakeScorer).Name;
+                string bucketScorerClass = nameof(FakeScorer);
                 CheckHits(searcher, bq, csq1.Boost + csq2.Boost, 
bucketScorerClass, null);
-                CheckHits(searcher, csqbq, csqbq.Boost, 
typeof(ConstantScoreQuery.ConstantScorer).Name, bucketScorerClass);
+                CheckHits(searcher, csqbq, csqbq.Boost, 
nameof(ConstantScoreQuery.ConstantScorer), bucketScorerClass);
             }
             finally
             {
diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs 
b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs
index 0b578a1b7..ce768214b 100644
--- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs
+++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoFormat.cs
@@ -62,12 +62,12 @@ namespace Lucene.Net.Codecs.Lucene3x
         public override SegmentInfoWriter SegmentInfoWriter => throw 
UnsupportedOperationException.Create("this codec can only be used for reading");
 
         // only for backwards compat
-        public static readonly string DS_OFFSET_KEY = 
typeof(Lucene3xSegmentInfoFormat).Name + ".dsoffset";
+        public const string DS_OFFSET_KEY = nameof(Lucene3xSegmentInfoFormat) 
+ ".dsoffset";
 
-        public static readonly string DS_NAME_KEY = 
typeof(Lucene3xSegmentInfoFormat).Name + ".dsname";
-        public static readonly string DS_COMPOUND_KEY = 
typeof(Lucene3xSegmentInfoFormat).Name + ".dscompound";
-        public static readonly string NORMGEN_KEY = 
typeof(Lucene3xSegmentInfoFormat).Name + ".normgen";
-        public static readonly string NORMGEN_PREFIX = 
typeof(Lucene3xSegmentInfoFormat).Name + ".normfield";
+        public const string DS_NAME_KEY = nameof(Lucene3xSegmentInfoFormat) + 
".dsname";
+        public const string DS_COMPOUND_KEY = 
nameof(Lucene3xSegmentInfoFormat) + ".dscompound";
+        public const string NORMGEN_KEY = nameof(Lucene3xSegmentInfoFormat) + 
".normgen";
+        public const string NORMGEN_PREFIX = nameof(Lucene3xSegmentInfoFormat) 
+ ".normfield";
 
         /// <returns> If this segment shares stored fields &amp; vectors, this
         ///         offset is where in that file this segment's docs begin.  
</returns>
diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosReader.cs 
b/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosReader.cs
index 32bcc29e5..06a29e06d 100644
--- a/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosReader.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40FieldInfosReader.cs
@@ -137,8 +137,8 @@ namespace Lucene.Net.Codecs.Lucene40
             }
         }
 
-        internal static readonly string LEGACY_DV_TYPE_KEY = 
typeof(Lucene40FieldInfosReader).Name + ".dvtype";
-        internal static readonly string LEGACY_NORM_TYPE_KEY = 
typeof(Lucene40FieldInfosReader).Name + ".normtype";
+        internal const string LEGACY_DV_TYPE_KEY = 
nameof(Lucene40FieldInfosReader) + ".dvtype";
+        internal const string LEGACY_NORM_TYPE_KEY = 
nameof(Lucene40FieldInfosReader) + ".normtype";
 
         // mapping of 4.0 types -> 4.2 types
         /*internal enum LegacyDocValuesType
diff --git a/src/Lucene.Net/Codecs/PerField/PerFieldDocValuesFormat.cs 
b/src/Lucene.Net/Codecs/PerField/PerFieldDocValuesFormat.cs
index 82799e38b..9e1e681c7 100644
--- a/src/Lucene.Net/Codecs/PerField/PerFieldDocValuesFormat.cs
+++ b/src/Lucene.Net/Codecs/PerField/PerFieldDocValuesFormat.cs
@@ -66,13 +66,13 @@ namespace Lucene.Net.Codecs.PerField
         /// <see cref="FieldInfo"/> attribute name used to store the
         /// format name for each field.
         /// </summary>
-        public static readonly string PER_FIELD_FORMAT_KEY = 
typeof(PerFieldDocValuesFormat).Name + ".format";
+        public const string PER_FIELD_FORMAT_KEY = 
nameof(PerFieldDocValuesFormat) + ".format";
 
         /// <summary>
         /// <see cref="FieldInfo"/> attribute name used to store the
         /// segment suffix name for each field.
         /// </summary>
-        public static readonly string PER_FIELD_SUFFIX_KEY = 
typeof(PerFieldDocValuesFormat).Name + ".suffix";
+        public const string PER_FIELD_SUFFIX_KEY = 
nameof(PerFieldDocValuesFormat) + ".suffix";
 
         /// <summary>
         /// Sole constructor. </summary>
diff --git a/src/Lucene.Net/Codecs/PerField/PerFieldPostingsFormat.cs 
b/src/Lucene.Net/Codecs/PerField/PerFieldPostingsFormat.cs
index 2738edcb6..1ffb28c9d 100644
--- a/src/Lucene.Net/Codecs/PerField/PerFieldPostingsFormat.cs
+++ b/src/Lucene.Net/Codecs/PerField/PerFieldPostingsFormat.cs
@@ -60,13 +60,13 @@ namespace Lucene.Net.Codecs.PerField
         /// <see cref="FieldInfo"/> attribute name used to store the
         /// format name for each field.
         /// </summary>
-        public static readonly string PER_FIELD_FORMAT_KEY = 
typeof(PerFieldPostingsFormat).Name + ".format";
+        public const string PER_FIELD_FORMAT_KEY = 
nameof(PerFieldPostingsFormat) + ".format";
 
         /// <summary>
         /// <see cref="FieldInfo"/> attribute name used to store the
         /// segment suffix name for each field.
         /// </summary>
-        public static readonly string PER_FIELD_SUFFIX_KEY = 
typeof(PerFieldPostingsFormat).Name + ".suffix";
+        public const string PER_FIELD_SUFFIX_KEY = 
nameof(PerFieldPostingsFormat) + ".suffix";
 
         /// <summary>
         /// Sole constructor. </summary>
diff --git a/src/Lucene.Net/Index/CheckIndex.cs 
b/src/Lucene.Net/Index/CheckIndex.cs
index 38d93d423..6eb9d94c8 100644
--- a/src/Lucene.Net/Index/CheckIndex.cs
+++ b/src/Lucene.Net/Index/CheckIndex.cs
@@ -2449,7 +2449,7 @@ namespace Lucene.Net.Index
                 // LUCENENET specific - we only output from our CLI wrapper
                 throw new ArgumentException("\nERROR: index path not 
specified");
                 //Console.WriteLine("\nERROR: index path not specified");
-                //Console.WriteLine("\nUsage: java Lucene.Net.Index.CheckIndex 
pathToIndex [-fix] [-crossCheckTermVectors] [-segment X] [-segment Y] 
[-dir-impl X]\n" + "\n" + "  -fix: actually write a new segments_N file, 
removing any problematic segments\n" + "  -crossCheckTermVectors: verifies that 
term vectors match postings; this IS VERY SLOW!\n" + "  -codec X: when fixing, 
codec to write the new segments_N file with\n" + "  -verbose: print additional 
details\n" + "  -segment X: only [...]
+                //Console.WriteLine("\nUsage: java Lucene.Net.Index.CheckIndex 
pathToIndex [-fix] [-crossCheckTermVectors] [-segment X] [-segment Y] 
[-dir-impl X]\n" + "\n" + "  -fix: actually write a new segments_N file, 
removing any problematic segments\n" + "  -crossCheckTermVectors: verifies that 
term vectors match postings; this IS VERY SLOW!\n" + "  -codec X: when fixing, 
codec to write the new segments_N file with\n" + "  -verbose: print additional 
details\n" + "  -segment X: only [...]
                 //Environment.Exit(1);
             }
 
diff --git a/src/Lucene.Net/Index/IndexUpgrader.cs 
b/src/Lucene.Net/Index/IndexUpgrader.cs
index 883ce7ff3..ae1e3cdaf 100644
--- a/src/Lucene.Net/Index/IndexUpgrader.cs
+++ b/src/Lucene.Net/Index/IndexUpgrader.cs
@@ -71,12 +71,12 @@ namespace Lucene.Net.Index
             throw new ArgumentException("One or more arguments was invalid");
             //Console.Error.WriteLine("Upgrades an index so all segments 
created with a previous Lucene version are rewritten.");
             //Console.Error.WriteLine("Usage:");
-            //Console.Error.WriteLine("  java " + typeof(IndexUpgrader).Name + 
" [-delete-prior-commits] [-verbose] [-dir-impl X] indexDir");
+            //Console.Error.WriteLine("  java " + nameof(IndexUpgrader) + " 
[-delete-prior-commits] [-verbose] [-dir-impl X] indexDir");
             //Console.Error.WriteLine("this tool keeps only the last commit in 
an index; for this");
             //Console.Error.WriteLine("reason, if the incoming index has more 
than one commit, the tool");
             //Console.Error.WriteLine("refuses to run by default. Specify 
-delete-prior-commits to override");
             //Console.Error.WriteLine("this, allowing the tool to delete all 
but the last commit.");
-            //Console.Error.WriteLine("Specify a " + typeof(FSDirectory).Name 
+ " implementation through the -dir-impl option to force its use. If no package 
is specified the " + typeof(FSDirectory).Namespace + " package will be used.");
+            //Console.Error.WriteLine("Specify a " + nameof(FSDirectory) + " 
implementation through the -dir-impl option to force its use. If no package is 
specified the " + typeof(FSDirectory).Namespace + " package will be used.");
             //Console.Error.WriteLine("WARNING: this tool may reorder document 
IDs!");
             //Environment.FailFast("1");
         }
diff --git a/src/Lucene.Net/Util/CommandLineUtil.cs 
b/src/Lucene.Net/Util/CommandLineUtil.cs
index 2b844a7fc..e0496d611 100644
--- a/src/Lucene.Net/Util/CommandLineUtil.cs
+++ b/src/Lucene.Net/Util/CommandLineUtil.cs
@@ -43,21 +43,21 @@ namespace Lucene.Net.Util
 
                 // LUCENENET: In .NET, we get a null when the class is not 
found, so we need to throw here for compatibility
                 if (clazz is null)
-                    throw new ArgumentException(typeof(FSDirectory).Name + " 
implementation not found: " + clazzName);
+                    throw new ArgumentException($"{nameof(FSDirectory)} 
implementation not found: {clazzName}");
 
                 return NewFSDirectory(clazz, dir);
             }
             catch (Exception e) when (e.IsClassNotFoundException())
             {
-                throw new ArgumentException(typeof(FSDirectory).Name + " 
implementation not found: " + clazzName, e);
+                throw new ArgumentException($"{nameof(FSDirectory)} 
implementation not found: {clazzName}", e);
             }
             catch (Exception e) when (e.IsClassCastException())
             {
-                throw new ArgumentException(clazzName + " is not a " + 
typeof(FSDirectory).Name + " implementation", e);
+                throw new ArgumentException($"{clazzName} is not a 
{nameof(FSDirectory)} implementation", e);
             }
             catch (Exception e) when (e.IsNoSuchMethodException())
             {
-                throw new ArgumentException(clazzName + " constructor with " + 
typeof(FileInfo).Name + " as parameter not found", e);
+                throw new ArgumentException($"{clazzName} constructor with 
{nameof(FileInfo)} as parameter not found", e);
             }
             catch (Exception e)
             {
@@ -91,7 +91,7 @@ namespace Lucene.Net.Util
         {
             if (clazzName is null || clazzName.Trim().Length == 0)
             {
-                throw new ArgumentException("The " + typeof(FSDirectory).Name 
+ " implementation cannot be null or empty");
+                throw new ArgumentException("The " + nameof(FSDirectory) + " 
implementation cannot be null or empty");
             }
 
             // LUCENENET specific: Changed to use char rather than string so 
we get StringComparison.Ordinal,

Reply via email to