L A

L A

  • NA
  • 170
  • 171.2k

Object reference not set to an instance of an object.

May 10 2018 11:33 PM
Hi,
 
I'm working on a console application which also have class library in it.
 
 
 
I added refrence of class library to console project as show above. In class library i have following code.
  1. namespace SomeClass  
  2. {  
  3.     public class ClassOne  
  4.     {  
  5.         public string[] SupportedFiles;  
  6.     }  
  7. }  
And in console app, program.cs, i'm trying to assign SupportedFiles.
  1. class Program  
  2.     {  
  3.         public ClassOne class1 { get; set; }  
  4.         public Program()  
  5.         {  
  6.             class1.SupportedArchitectures = new string[] { "Test""Test" };  
  7.         }  
  8.    }  
But line number 6 class1.SupportedArchitectures = new string[] { "Test", "Test" }; throws an error.
 
 
 
What am i missing? Am I so dumb instantiating a string array. Please help me out

Answers (1)