我正在阅读关于MVC-Linq to SQL的教程。在这里,我注意到他们正在使用的对象名称下划线(在对象名称第一个字符),如“_dataContext”以下划线开头的对象名称
下面是代码:
using System.Collections.Generic;
using System.Linq;
namespace MvcApplication1.Models
{
public class MovieRepository : IMovieRepository
{
private MovieDataContext _dataContext;
public MovieRepository()
{
_dataContext = new MovieDataContext();
}
#region IMovieRepository Members
public IList<Movie> ListAll()
{
var movies = from m in _dataContext.Movies
select m;
return movies.ToList();
}
#endregion
}
}
我的问题是,什么是使用这个的目的强调?
相关阅读:[成员变量的下划线前缀。 intellisense](http://stackoverflow.com/q/833811) – 2012-02-02 22:22:36