I'm working on a console application which also had reference to class library. In class library i have following code.
namespace SomeClass
{
public class ClassOne
{
public string[] SupportedFiles;
}
}
And in console app, program.cs, i'm trying to assign SupportedFiles.
class Program
{
public ClassOne class1 { get; set; }
public Program()
{
class1.SupportedFiles = new string[] { "Test", "Test" };
//class1.SupportedFiles[0] = "First";
//class1.SupportedFiles[1] = "Second";
}
}
But the line class1.SupportedFiles = new string[] { "Test", "Test" };
throws
System.NullReferenceException: 'Object reference not set to an instance of an object.'
What am i missing? Am I so dumb instantiating a string array. Please help me out.