You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/10/02 14:35:28 UTC

[10/50] [abbrv] lucenenet git commit: Added an exception in the toString() extension method because string implements IEnumerable but we just want it to be returned unchanged.

Added an exception in the toString() extension method because string implements IEnumerable but we just want it to be returned unchanged.


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

Branch: refs/heads/master
Commit: 0f5cc74bc493fd1b4f7f31bf23bd12dae093330b
Parents: a62a664
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 15 22:54:24 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Oct 2 17:44:13 2016 +0700

----------------------------------------------------------------------
 .../JavaCompatibility/SystemTypesHelpers.cs                      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0f5cc74b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
index ad80c9f..b2f19c4 100644
--- a/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
+++ b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
@@ -23,7 +23,9 @@ namespace Lucene.Net
             // by defaulting the behavior to return a concatenated
             // list of the contents of enumerables rather than the 
             // .NET type name (similar to the way Java behaves).
-            if (obj is IEnumerable)
+            // Unless of course we already have a string (which
+            // implements IEnumerable so we need skip it).
+            if (obj is IEnumerable && !(obj is string))
             {
                 string result = obj.ToString();
                 // Assume that this is a default call to object.ToString()