我在函数的前面放了什么修饰符都没关系(我尝试过使用public,private甚至protected),但我总是收到一个错误,同样的错误。仅在删除修饰符且函数“ Array()”不包含任何修饰符后,代码才干净。有人可以看一下我的代码并向我解释发生了什么吗,我是c#的新手,还是寻求帮助的新手,所以请原谅我迄今为止犯的所有错误。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
public void Array()//nu se pune in interiorul functiei void Main (), deoarece va forma nesting, si ne va da eroare la compilare.
{
int[] intArray;
intArray = new int[3];//all values will be 3
var doubleArray = new[] { 34.23, 10.2, 23.2 };
//var arrayElement = doubleArray[0];
//doubleArray[1] = 5.55;
for (var i = 0; i < intArray.Length; …Run Code Online (Sandbox Code Playgroud) 今天我们数据结构的老师在学习栈的时候提到了这一点,但是没有给出正确的解释。
stack-overflow programming-languages buffer-overflow data-structures