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;
}