c# - Adding a Vector2 to List -


i have code

    public list<vector2> alienposition = new list<vector2>();      (int x = 0; x < alienposition.count; x++)         {             alienposition[x].add(new vector2((x * 20) + 50, 20));         } 

and gives me error add doesnt take 1 argument. doing wrong?

 public list<vector2> alienposition = new list<vector2>();     int somecount = 10;         (int x = 0; x < somecount; x++)             {                 alienposition.add(new vector2((x * 20) + 50, 20));             } 

remove [i] indexer , specify end condition loop > 0

the [i] needed simple arrays. list more high level data structure convenience methods add elements directly list. it's part of list api able add new entries without having specify index new entry. add new entries end of list.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -