using System.Text.Json; var builder = new ArrayBuilder(); builder.Add(1); builder.Add(2); builder.Add(3); if(builder.Contains(2)) { Console.WriteLine("Array contains element 2"); }
using System.Text.Json; var builder = new ArrayBuilderIn this example, an instance of ArrayBuilder class is created for strings and some values are added using the AddRange method. The Contains method is then used to check if the array contains the element 'four'. The ArrayBuilder class is part of the System.Text.Json.Serialization package library in C#.(); builder.AddRange(new [] {"one", "two", "three"}); if(builder.Contains("four")) { Console.WriteLine("Array contains element 'four'"); }