Hi, i am trying to access a field in an array of objects but i get this
error "Exception System.NullReferenceException was thrown in debuggee:Object
reference not set to an instance of an object".What am i doing wrong?
using System;
using System.Collections.Generic;
namespace ObjectArray
{
class MyClass
{
public int x=0;
}
class MainClass
{
string a;
public static void Main(string[] args)
{
MyClass[] myobject=new MyClass[10];
myobject[1].x=10;// error here
Console.ReadLine();
}
}
}