BigML.Utils.sameElement C# (CSharp) Method

sameElement() public static method

Determines if the given collection contain the same value. We will use the contains method of the list to check if the value is inside
public static sameElement ( IList collection, object value ) : bool
collection IList the list of elements
value object the value to check.
return bool
        public static bool sameElement(IList collection, object value)
        {
            if (collection == null || collection.Count == 0)
            {
                return false;
            }

            // Iterate over the elements of the collection.
            foreach (object collectionValue in collection)
            {
                // Check if the element in the collection is the same of value
                if (!collectionValue.Equals(value))
                {
                    return false;
                }
            }

            return true;
        }