使用myArray.GetValue(2)和myArray [2]有什么区别吗?C#中myArray.GetValue(2)和myArray [2]之间的区别是什么?
例如:
namespace ConsoleApplication16
{
class Program
{
static void Main(string[] args)
{
int[] numbers = new int[] { 1, 2, 3, 4 };
Console.WriteLine(numbers.GetValue(3));
Console.WriteLine(numbers[3]);
Console.ReadLine();
}
}
}
不在您编写的代码中。对于非基于0的数组和不支持索引器的语言(或数组...)非常有用。) –