一維數組在C#中的常見操作包括:
int[] numbers = new int[5];
int element = numbers[2];
for(int i = 0; i < numbers.Length; i++)
{
Console.WriteLine(numbers[i]);
}
foreach(int num in numbers)
{
Console.WriteLine(num);
}
numbers[2] = 10;
int length = numbers.Length;
int index = Array.IndexOf(numbers, 5);
bool contains = numbers.Contains(10);
Array.Sort(numbers);
Array.Reverse(numbers);