c# error: is a 'field' but is used as a 'type' when trying to use while loop -


i going through euler project c# learn language , keep coding skills sharp on summer break (i'm college student). new language. tried answers error other similar questions found don't deal while loops. code having issue is:

using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace eulerproblems {     class problem2     {         list<int> fib = new list<int>();         bool notatlimit = true;          while(notatlimit)         {              //code populate list of fibonacci series         }     } } 

you cannot write code directly within class. need write inside method, e.g.

private void test() {     list<int> fib = new list<int>();     bool notatlimit = true;      while (notatlimit)     {         //code populate list of fibonacci series     } } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -