Reputation: 101
I'm just creating a web application and I stuck with the problem. What is the correct way to inporting types? This is my classes into App_Data folder. Actually, all properties of my classes were changed like this: Build Action - Content (moved to Compile).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace sample.App_Code.HistoricalStock
{
public class HistoricalStock
{
public DateTime Date { get; set; }
public double Open { get; set; }
public double High { get; set; }
public double Low { get; set; }
public double Close { get; set; }
public double Volume { get; set; }
public double AdjClose { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using sample.App_Code.HistoricalStock;
namespace sample.App_Code.HistoricalStockDownload
{
public class HistoricalStockDownloader
{
public static List<HistoricalStock> DownloadData(string ticker, int yearToStartFrom)
{
List<HistoricalStock> retval = new List<HistoricalStock>();
// some code
return retval;
}
}
}
Upvotes: 1
Views: 141
Reputation: 3246
I don't really get your problem but it is not a good idea to have a type and namespace part with identical name.
sample.App_Code.HistoricalStock
HistoricalStock
Because when you try to use List<HistoricalStock>
in the HistoricalStockDownloader
class it may not even be compiled.
Upvotes: 2