contains

Summary

Checks if an element is in the array.

Usage

public bool contains(T value)

Returns

true if the element is in the array and false otherwise.

Parameters

value

The element to find in the array.

Description

Checks if an element is in the array. By default, this check uses value equality for primitive data types and reference equality otherwise. This behavior can be overridden by implementing the System.ILike<T> interface.

This method does not mutate the array.

Examples

Basic Usage
1
2
3
4
5
import System;
 
int[] arr = [ 1, 2, 3 ];
Console.log(arr.contains(3)); // true
Console.log(arr.contains(4)); // false

Share

HTML | BBCode | Direct Link