c# - The name "xx" does not exist in the current context -
my program keeps getting error "the name "ok" not exist in current context." doing wrong?
namespace game { class program { static bool selftest() { bool ok = gamemodel.selftest(); if (ok) system.diagnostics.debug.writeline("succeded"); else system.diagnostics.debug.writeline("failed"); return ok; } static void main(string[] args) { bool ok = selftest(); } } } namespace game { class gamemodel { public static bool selftest() { ok = true; return ok; } } }
change
public static bool selftest() { ok = true; return ok; }
to
public static bool selftest() { bool ok = true; return ok; }
or perhaps just
public static bool selftest() { return true; }
Comments
Post a Comment