I have searched through many similar questions to this, none have had the answer for my own issues.. In an ASP.Net MVC application I have 2 projects, an ASP.NET Web Application (.Net Framework) and a Class library.
In a Controller in the Web App I am trying to instantiate an object of one of the classes in the Class library, however, I get the error that is the title of the post.
This is the constructor part of the class I am trying to access..
namespace GoogleDirections
{
public sealed class Geocoder : HttpWebService
{
public Geocoder(string key) : base(key)
{
}
}
And this is the call in the controller..
public double[] GetLatLong(string address)
{
double[] latLng = new double[2];
var geocoder = new Geocoder("xxxMyAPIKeyblahblahxx");
return latLng;
}
The error is "'Geocoder' is a Namespace but used as a Type"
The controller has using statement using GoogleDirections; and references the Class library that contains the Geocoder class.
using GoogleDirections; and references the Class library that contains the Geocoder class.
Does anyone have a clue what I might have been missing?
按照通信中的说明,尝试编写new GoogleDirections.Geocoder("YourKey")
或Geocoder类所在的名称空间,但在此处可以将其标记为答案。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.