c# - "Type or namespace name *name* cannot be found" Error only in method declarations -
i getting "type or namespace name name cannot found" error, but in method declarations, , on 2 specific object types:
public list<transit> getstops() //this throws error { list<transit> stops = new list<transit>(); //this not throw error if try access transit through path.to.namespace.transit in method declaration, still error. visual studio 2012 can find class in auto suggestions both in method declaration, , below (before try build again). code below throw no errors:
public list<string> getstops() { list<transit> stops = new list<transit>(); //no error this occurs 2 classes located in namespace.
public stop getcurrentstop() //error { stop stop = new stop(); // no error the rest of classes in namespace not throw error. both classes public , contain constructor. visual studio list both objects suggestions, , map them correct namespace in code below method declaration.
here example of 1 of classes:
using system; using system.collections.generic; using system.linq; using system.text; namespace path.to.namespace { public class transit { public string id { get; private set; } public string name { get; private set; } public travel mode {get; private set;} //class in same namespace public location stoppoint { get; private set; } //class in same namespace public transit(string id, string name, travel mode, location stoppoint) { id = id; name = name; mode = mode; stoppoint = stoppoint; } } } the other 1 similar, different object types. , restarting pc/vs did not solve issue
Comments
Post a Comment