CurtHagenlocher commented on code in PR #41539:
URL: https://github.com/apache/arrow/pull/41539#discussion_r1597492437


##########
csharp/src/Apache.Arrow/Arrays/PrimitiveArray.cs:
##########
@@ -86,5 +86,29 @@ IEnumerator IEnumerable.GetEnumerator()
                 yield return IsValid(index) ? Values[index] : null;
             }
         }
+
+        int ICollection<T?>.Count => Length;
+        bool ICollection<T?>.IsReadOnly => true;
+        void ICollection<T?>.Add(T? item) => throw new 
NotSupportedException("Collection is read-only.");
+        bool ICollection<T?>.Remove(T? item) => throw new 
NotSupportedException("Collection is read-only.");
+        void ICollection<T?>.Clear() => throw new 
NotSupportedException("Collection is read-only.");
+
+        bool ICollection<T?>.Contains(T? item)
+        {
+            if (item == null)
+            {
+                return NullCount > 0;
+            }
+
+            return Values.IndexOf(item.Value) >= 0;

Review Comment:
   This isn't sufficient because the data buffer has to be initialized with 
something but the individual value might still be null. Consider an int32 
vector of all nulls. There's a pretty good probability that Values.IndexOf(0) 
would find something.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to