using
使用语句有编程上的好处吗?
请注意此示例之间的区别:
using Application.Data;
namespace Application.Web
{
public class SampleClass
{
public void SampleMethod()
{
List<Category> categories = CreateCategoriesData();
Category expected = categories[0];
...
...
}
}
}
和这个:
namespace Application.Web
{
public class SampleClass
{
public void SampleMethod()
{
List<Data.Category> categories = CreateCategoriesData();
Data.Category expected = categories[0];
...
...
}
}
}