I am very new to C#, while studying the array
in C#, I have created a small example, where I was trying to assign value to array
. However, every time, the compiler gives the error:
array name doesn't exist in current context.
My code as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Calculator
{
int sum;
int[] EvenArray;
List<int> evenNumbers = new List<int>();
string[] randomNames = new string[10];
//This line gives an complie time error, as randomNames doesn't exist in current context
randomNames[0]="Savresh";
}