c# - the name 'lanesList' does not exist in the current context -


    static void createlanes()     {         (int = 0; < 3; i++)         {             laneslist.add(new lanes(i));         }     } 

im new code , wondering why keep giving me error.

thanks in advance

you forgot initialise lanelist before add elements it. try code:

static void createlanes() {     list<lanes> laneslist = new list<lanes>();     (int = 0; < 3; i++)     {         laneslist.add(new lanes(i));     } } 

or if initialise outside of method need pass parameter:

static void createlanes(list<lanes> laneslist) {      (int = 0; < 3; i++)      {         laneslist.add(new lanes(i));      } } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -